|
| 1 | +// tests/stdlib_v0.9.0.prox |
| 2 | +// Verification script for ProXPL v0.9.0 features |
| 3 | + |
| 4 | +use std.native.gc; |
| 5 | +use std.native.time; |
| 6 | +use std.native.fs; |
| 7 | + |
| 8 | +func test_gc() { |
| 9 | + print("Testing std.gc..."); |
| 10 | + |
| 11 | + // Test gc.stats |
| 12 | + let stats = gc.stats(); |
| 13 | + print("GC Stats: " + to_string(stats)); |
| 14 | + |
| 15 | + // Test gc.collect |
| 16 | + let freed = gc.collect(); |
| 17 | + print("GC Collected bytes: " + to_string(freed)); |
| 18 | + |
| 19 | + // Stress (optional manual check) |
| 20 | + // gc.stress(true); |
| 21 | +} |
| 22 | + |
| 23 | +func test_time() { |
| 24 | + print("\nTesting std.time expansions..."); |
| 25 | + |
| 26 | + let now = time.now(); |
| 27 | + print("Current timestamp: " + to_string(now)); |
| 28 | + |
| 29 | + // Test strftime |
| 30 | + let formatted = time.strftime("%Y-%m-%d %H:%M:%S", now); |
| 31 | + print("Formatted date: " + formatted); |
| 32 | + |
| 33 | + // Test custom timestamp |
| 34 | + // 2025-12-25 10:30:00 |
| 35 | + let ts = time.timestamp(2025, 12, 25, 10, 30, 0); |
| 36 | + print("Christmas 2025 timestamp: " + to_string(ts)); |
| 37 | + let verify = time.strftime("%Y-%m-%d", ts); |
| 38 | + print("Verify Christmas: " + verify); |
| 39 | + if (verify == "2025-12-25") { |
| 40 | + print("Timestamp OK"); |
| 41 | + } else { |
| 42 | + print("Timestamp FAILED"); |
| 43 | + } |
| 44 | +} |
| 45 | + |
| 46 | +func test_fs() { |
| 47 | + print("\nTesting std.fs expansions..."); |
| 48 | + |
| 49 | + let test_file = "test_move_src.txt"; |
| 50 | + let dest_file = "test_move_dest.txt"; |
| 51 | + |
| 52 | + fs.write_file(test_file, "move me"); |
| 53 | + |
| 54 | + // Test abspath |
| 55 | + let abs = fs.abspath(test_file); |
| 56 | + print("Abs Path: " + abs); |
| 57 | + |
| 58 | + // Test move |
| 59 | + let moved = fs.move(test_file, dest_file); |
| 60 | + print("Moved: " + to_string(moved)); |
| 61 | + |
| 62 | + if (fs.exists(dest_file) && !fs.exists(test_file)) { |
| 63 | + print("Move OK"); |
| 64 | + } else { |
| 65 | + print("Move FAILED"); |
| 66 | + } |
| 67 | + |
| 68 | + // Cleanup |
| 69 | + fs.remove(dest_file); |
| 70 | +} |
| 71 | + |
| 72 | +func main() { |
| 73 | + print("=== ProXPL v0.9.0 Feature Verification ==="); |
| 74 | + test_gc(); |
| 75 | + test_time(); |
| 76 | + test_fs(); |
| 77 | + print("\nALL CHECKS COMPLETED"); |
| 78 | +} |
| 79 | + |
| 80 | +main(); |
0 commit comments