Bob/tests.bob
Bobby Lucero 7f7c6e438d Started fleshing out built in modules.
added policy templates for module safety
2025-08-12 03:26:50 -04:00

96 lines
2.6 KiB
Plaintext

// // var a = [];
// // for(var i = 0; i < 1000000; i++){
// // print(i);
// // // Create nested structures with functions at different levels
// // if (i % 4 == 0) {
// // // Nested array with function
// // push(a, [
// // func(){print("Array nested func i=" + i); return i;},
// // [func(){return "Deep array func " + i;}],
// // i
// // ]);
// // } else if (i % 4 == 1) {
// // // Nested dict with function
// // push(a, {
// // "func": func(){print("Dict func i=" + i); return i;},
// // "nested": {"deepFunc": func(){return "Deep dict func " + i;}},
// // "value": i
// // });
// // } else if (i % 4 == 2) {
// // // Mixed nested array/dict with functions
// // push(a, [
// // {"arrayInDict": func(){return "Mixed " + i;}},
// // [func(){return "Array in array " + i;}, {"more": func(){return i;}}],
// // func(){print("Top level in mixed i=" + i); return i;}
// // ]);
// // } else {
// // // Simple function (original test case)
// // push(a, func(){print("Simple func i=" + i); return toString(i);});
// // }
// // }
// // print("Before: " + len(a));
// // print("Memory usage: " + memoryUsage() + " MB");
// // // Test different types of nested function calls
// // a[3691](); // Simple function
// // if (len(a[3692]) > 0) {
// // a[3692][0](); // Nested array function
// // }
// // if (a[3693]["func"]) {
// // a[3693]["func"](); // Nested dict function
// // }
// // //print(a);
// // //writeFile("array_contents.txt", toString(a));
// // print("Array contents written to array_contents.txt");
// // print("Memory before cleanup: " + memoryUsage() + " MB");
// // input("Press any key to free memory");
// // a = none;
// // print("Memory after cleanup: " + memoryUsage() + " MB");
// // input("waiting...");
// class Test {
// func init() {
// print("Test init" + this.a);
// }
// var a = 10;
// func test() {
// //print(a);
// print(this.a);
// }
// }
// var arr = [];
// for(var i = 0; i < 100; i++){
// arr.push(i);
// }
// var counter = 0;
// try{
// while(true){
// print(arr[counter]);
// counter++;
// //sleep(0.01);
// }
// }catch(){}
// try{
// assert(false);
// }catch(){}
// print("done");
// Modules: basic imports suite
var pathMods = fileExists("tests/test_imports_basic.bob") ? "tests/test_imports_basic.bob" : "../tests/test_imports_basic.bob";
evalFile(pathMods);
print("done");