114 lines
5.1 KiB
Plaintext
114 lines
5.1 KiB
Plaintext
print("=== PROPER REGRESSION TEST ===");
|
|
print("Generating correct Bob code with proper syntax...");
|
|
|
|
// ========================================
|
|
// PHASE 1: WRITE CORRECT BOB CODE TO FILE
|
|
// ========================================
|
|
print("\n📝 PHASE 1: Writing correct Bob code to file...");
|
|
|
|
// Create a properly formatted Bob program with correct syntax
|
|
var correctProgram = "print(\"=== PROPER REGRESSION BUSTER ===\");\n";
|
|
correctProgram = correctProgram + "print(\"Testing ALL features with correct syntax...\");\n";
|
|
|
|
// Add basic variable declarations with proper semicolons
|
|
correctProgram = correctProgram + "var testArray = [];\n";
|
|
correctProgram = correctProgram + "var testDict = {};\n";
|
|
correctProgram = correctProgram + "var testString = \"Hello, Bob!\";\n";
|
|
correctProgram = correctProgram + "var testNumber = 42;\n";
|
|
correctProgram = correctProgram + "var testBoolean = true;\n";
|
|
|
|
// Add array operations with proper syntax
|
|
correctProgram = correctProgram + "for (var i = 0; i < 10; i = i + 1) {\n";
|
|
correctProgram = correctProgram + " push(testArray, i * i);\n";
|
|
correctProgram = correctProgram + " testDict[\"key_\" + toString(i)] = i * 2;\n";
|
|
correctProgram = correctProgram + "}\n";
|
|
|
|
// Add string indexing with proper syntax
|
|
correctProgram = correctProgram + "print(\"String indexing test:\");\n";
|
|
correctProgram = correctProgram + "for (var i = 0; i < len(testString); i = i + 1) {\n";
|
|
correctProgram = correctProgram + " print(\"Character \" + toString(i) + \": \" + testString[i]);\n";
|
|
correctProgram = correctProgram + "}\n";
|
|
|
|
// Add function definition with proper syntax
|
|
correctProgram = correctProgram + "func testFunction(x, y) {\n";
|
|
correctProgram = correctProgram + " return x + y * 2;\n";
|
|
correctProgram = correctProgram + "}\n";
|
|
correctProgram = correctProgram + "var result = testFunction(5, 10);\n";
|
|
correctProgram = correctProgram + "print(\"Function result: \" + toString(result));\n";
|
|
|
|
// Add eval test with proper syntax
|
|
correctProgram = correctProgram + "var evalResult = eval(\"5 * 5 + 10\");\n";
|
|
correctProgram = correctProgram + "print(\"Eval result: \" + toString(evalResult));\n";
|
|
|
|
// Add final summary with proper syntax
|
|
correctProgram = correctProgram + "print(\"✅ All core features working!\");\n";
|
|
correctProgram = correctProgram + "print(\"✅ Arrays: \" + toString(len(testArray)) + \" elements\");\n";
|
|
correctProgram = correctProgram + "print(\"✅ Dictionaries: \" + toString(len(testDict)) + \" entries\");\n";
|
|
correctProgram = correctProgram + "print(\"✅ String indexing: \" + toString(len(testString)) + \" characters\");\n";
|
|
correctProgram = correctProgram + "print(\"✅ Functions: working\");\n";
|
|
correctProgram = correctProgram + "print(\"✅ Eval: working\");\n";
|
|
correctProgram = correctProgram + "print(\"🎉 PROPER REGRESSION TEST PASSED!\");\n";
|
|
|
|
// Write the correct program to a file
|
|
writeFile("proper_regression_dynamic.bob", correctProgram);
|
|
print("✅ Correct Bob code written to file: proper_regression_dynamic.bob");
|
|
|
|
// ========================================
|
|
// PHASE 2: LOAD AND RUN THE CORRECT PROGRAM
|
|
// ========================================
|
|
print("\n📂 PHASE 2: Loading and running the correct program...");
|
|
|
|
// Check if file exists
|
|
var fileExists = fileExists("proper_regression_dynamic.bob");
|
|
print(" File exists: " + toString(fileExists));
|
|
|
|
if (fileExists) {
|
|
// Read the file content
|
|
var loadedCode = readFile("proper_regression_dynamic.bob");
|
|
print(" File loaded successfully!");
|
|
print(" File size: " + toString(len(loadedCode)) + " characters");
|
|
|
|
// Use eval to run the loaded code
|
|
print("\n⚡ PHASE 3: Executing correct program with eval...");
|
|
print("🚀 STARTING PROPER REGRESSION BUSTER...");
|
|
|
|
var evalResult = eval(loadedCode);
|
|
|
|
print("\n✅ PROGRAM EXECUTION COMPLETE!");
|
|
print("✅ File I/O worked perfectly!");
|
|
print("✅ Eval executed the entire program!");
|
|
print("✅ All features tested successfully!");
|
|
|
|
} else {
|
|
print("❌ ERROR: File not found!");
|
|
}
|
|
|
|
// ========================================
|
|
// PHASE 4: VERIFICATION
|
|
// ========================================
|
|
print("\n🔍 PHASE 4: Verification...");
|
|
|
|
// Verify the file was created and has content
|
|
var verificationFile = readFile("proper_regression_dynamic.bob");
|
|
var fileLength = len(verificationFile);
|
|
|
|
print(" Verification file length: " + toString(fileLength) + " characters");
|
|
print(" File contains correct program: " + toString(len(verificationFile) > 100));
|
|
|
|
// ========================================
|
|
// FINAL SUMMARY
|
|
// ========================================
|
|
print("\n🎉 PROPER REGRESSION TEST COMPLETE!");
|
|
print("✅ Successfully wrote correct Bob code to file");
|
|
print("✅ Successfully loaded file with file I/O");
|
|
print("✅ Successfully executed with eval");
|
|
print("✅ All features working together perfectly!");
|
|
|
|
print("\n🏆 PROPER TEST PASSED!");
|
|
print("Bob can write correct programs to files!");
|
|
print("Bob can read files with file I/O!");
|
|
print("Bob can execute loaded code with eval!");
|
|
print("Bob is UNSTOPPABLE!");
|
|
|
|
print("\n🚀 BOB IS THE ULTIMATE PROGRAMMING LANGUAGE! 🚀");
|
|
print("🎊 PROPER REGRESSION TEST COMPLETE! 🎊"); |