Files
FoxLang/test_complete.fox
T

60 lines
1.6 KiB
Plaintext

// Полный тест новых возможностей FoxLang 4.0
using net;
// Новые типы данных
float temperature = 36.6;
bool isOnline = true;
bool hasError = false;
print("=== Тест новых типов ===");
print("Temperature: " + temperature);
print("Online status: " + isOnline);
print("Error status: " + hasError);
// Тест boolean логики
if (isOnline && !hasError) {
print("System is healthy");
}
if (temperature > 36.0) {
print("Temperature is normal");
}
// Тест сетевых функций
print("\n=== Тест сетевых функций ===");
string response = http_get("https://api.example.com/data");
print("HTTP GET: " + response);
string postResult = http_post("https://api.example.com/submit", "data=test");
print("HTTP POST: " + postResult);
// TCP тест
int tcpSocket = tcp_socket();
print("TCP Socket created: " + tcpSocket);
bool connected = tcp_connect(tcpSocket, "localhost", 8080);
if (connected) {
print("TCP connection established");
int bytesSent = tcp_send(tcpSocket, "Hello TCP Server!");
print("Bytes sent: " + bytesSent);
string received = tcp_receive(tcpSocket, 1024);
print("Received: " + received);
tcp_close(tcpSocket);
print("TCP connection closed");
}
// UDP тест
int udpSocket = udp_socket();
print("UDP Socket created: " + udpSocket);
int udpSent = udp_send(udpSocket, "localhost", 9090, "Hello UDP!");
print("UDP bytes sent: " + udpSent);
string udpData = udp_receive(udpSocket, 512);
print("UDP received: " + udpData);
print("\n=== Тест завершен ===");
fox();