big commit

This commit is contained in:
2026-01-27 01:04:08 +01:00
parent 66933433d1
commit 5456c9414a
15 changed files with 821 additions and 222 deletions

View File

@@ -134,3 +134,83 @@ fn truthy_nonzero() {
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 pick_first() {
expect_int("{ 10 } { 20 } { 30 } 0 pick", 10);
}
#[test]
fn pick_second() {
expect_int("{ 10 } { 20 } { 30 } 1 pick", 20);
}
#[test]
fn pick_third() {
expect_int("{ 10 } { 20 } { 30 } 2 pick", 30);
}
#[test]
fn pick_preserves_stack() {
expect_int("5 { 10 } { 20 } 0 pick +", 15);
}