diff options
Diffstat (limited to 'awk/rawk/test_basic.rawk')
| -rw-r--r-- | awk/rawk/test_basic.rawk | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/awk/rawk/test_basic.rawk b/awk/rawk/test_basic.rawk new file mode 100644 index 0000000..d92091a --- /dev/null +++ b/awk/rawk/test_basic.rawk @@ -0,0 +1,26 @@ +# Basic rawk function definitions +$add = (x, y) -> x + y; +$multiply = (a, b) -> a * b; +$greet = (name) -> "Hello, " name; + +# Test the functions +BEGIN { + print "Testing basic functions:" + + # Test add function + result = add(5, 3) + expect_equal(result, 8, "add(5, 3) should return 8") + print "✓ add(5, 3) = " result + + # Test multiply function + result = multiply(4, 7) + expect_equal(result, 28, "multiply(4, 7) should return 28") + print "✓ multiply(4, 7) = " result + + # Test greet function + result = greet("World") + expect_equal(result, "Hello, World", "greet(\"World\") should return 'Hello, World'") + print "✓ greet(\"World\") = " result + + print "🎉 All basic function tests passed!" +}
\ No newline at end of file |