Init
This commit is contained in:
136
tests/forth/comparison.rs
Normal file
136
tests/forth/comparison.rs
Normal file
@@ -0,0 +1,136 @@
|
||||
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);
|
||||
}
|
||||
Reference in New Issue
Block a user