use super::harness::*; #[test] fn eq_true() { expect_int("3 3 =", 1); } #[test] fn eq_false() { expect_int("3 4 =", 0); } #[test] fn eq_mixed_types() { expect_int("3.0 3 =", 1); } #[test] fn ne_true() { expect_int("3 4 <>", 1); } #[test] fn ne_false() { expect_int("3 3 <>", 0); } #[test] fn lt_true() { expect_int("2 3 lt", 1); } #[test] fn lt_equal() { expect_int("3 3 lt", 0); } #[test] fn lt_false() { expect_int("4 3 lt", 0); } #[test] fn gt_true() { expect_int("4 3 gt", 1); } #[test] fn gt_equal() { expect_int("3 3 gt", 0); } #[test] fn gt_false() { expect_int("2 3 gt", 0); } #[test] fn le_less() { expect_int("2 3 <=", 1); } #[test] fn le_equal() { expect_int("3 3 <=", 1); } #[test] fn le_greater() { expect_int("4 3 <=", 0); } #[test] fn ge_greater() { expect_int("4 3 >=", 1); } #[test] fn ge_equal() { expect_int("3 3 >=", 1); } #[test] fn ge_less() { expect_int("2 3 >=", 0); } #[test] fn and_tt() { expect_int("1 1 and", 1); } #[test] fn and_tf() { expect_int("1 0 and", 0); } #[test] fn and_ff() { expect_int("0 0 and", 0); } #[test] fn or_tt() { expect_int("1 1 or", 1); } #[test] fn or_tf() { expect_int("1 0 or", 1); } #[test] fn or_ff() { expect_int("0 0 or", 0); } #[test] fn not_true() { expect_int("1 not", 0); } #[test] fn not_false() { expect_int("0 not", 1); } #[test] fn truthy_nonzero() { expect_int("5 not", 0); } #[test] fn truthy_negative() { expect_int("-1 not", 0); } #[test] fn xor_tt() { expect_int("1 1 xor", 0); } #[test] fn xor_tf() { expect_int("1 0 xor", 1); } #[test] fn xor_ft() { expect_int("0 1 xor", 1); } #[test] fn xor_ff() { expect_int("0 0 xor", 0); } #[test] fn nand_tt() { expect_int("1 1 nand", 0); } #[test] fn nand_tf() { expect_int("1 0 nand", 1); } #[test] fn nand_ff() { expect_int("0 0 nand", 1); } #[test] fn nor_tt() { expect_int("1 1 nor", 0); } #[test] fn nor_tf() { expect_int("1 0 nor", 0); } #[test] fn nor_ff() { expect_int("0 0 nor", 1); } #[test] fn ifelse_true() { expect_int("( 42 ) ( 99 ) 1 ifelse", 42); } #[test] fn ifelse_false() { expect_int("( 42 ) ( 99 ) 0 ifelse", 99); } #[test] fn select_first() { expect_int("( 10 ) ( 20 ) ( 30 ) 0 select", 10); } #[test] fn select_second() { expect_int("( 10 ) ( 20 ) ( 30 ) 1 select", 20); } #[test] fn select_third() { expect_int("( 10 ) ( 20 ) ( 30 ) 2 select", 30); } #[test] fn select_preserves_stack() { expect_int("5 ( 10 ) ( 20 ) 0 select +", 15); }