github.com/lmorg/murex@v0.0.0-20240217211045-e081c89cd4ef/builtins/core/structs/and_test.go (about) 1 package structs 2 3 import ( 4 "testing" 5 6 "github.com/lmorg/murex/test" 7 ) 8 9 // TestAnd tests the `and` builtin 10 func TestAnd(t *testing.T) { 11 tests := []test.BooleanTest{ 12 // --- and --- 13 { 14 Block: "and { true } { true } { true }", 15 Result: true, 16 }, 17 { 18 Block: "and { false } { true } { true }", 19 Result: false, 20 }, 21 { 22 Block: "and { true } { false } { true }", 23 Result: false, 24 }, 25 { 26 Block: "and { true } { true } { false }", 27 Result: false, 28 }, 29 { 30 Block: "and { false } { true } { false }", 31 Result: false, 32 }, 33 { 34 Block: "and { false } { false } { false }", 35 Result: false, 36 }, 37 // --- !and --- 38 { 39 Block: "!and { true } { true } { true }", 40 Result: false, 41 }, 42 { 43 Block: "!and { false } { true } { true }", 44 Result: false, 45 }, 46 { 47 Block: "!and { true } { false } { true }", 48 Result: false, 49 }, 50 { 51 Block: "!and { true } { true } { false }", 52 Result: false, 53 }, 54 { 55 Block: "!and { false } { true } { false }", 56 Result: false, 57 }, 58 { 59 Block: "!and { false } { false } { false }", 60 Result: true, 61 }, 62 } 63 64 test.RunBooleanTests(tests, t) 65 }