17 lines
353 B
Text
17 lines
353 B
Text
|
|
func a(bool) { print 'A'; return bool }
|
|||
|
|
func b(bool) { print 'B'; return bool }
|
|||
|
|
|
|||
|
|
# Test-driver
|
|||
|
|
func test() {
|
|||
|
|
for op in ['&&', '||'] {
|
|||
|
|
for x,y in [[1,1],[1,0],[0,1],[0,0]] {
|
|||
|
|
"a(%s) %s b(%s): ".printf(x, op, y)
|
|||
|
|
eval "a(Bool(x)) #{op} b(Bool(y))"
|
|||
|
|
print "\n"
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
# Test and display
|
|||
|
|
test()
|