1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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!"
}
|