Skip to content

Commit

Permalink
actualize stdlib for the new clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
orsinium committed Nov 21, 2023
1 parent 25297d3 commit a1f0a61
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 67 deletions.
1 change: 1 addition & 0 deletions Taskfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ tasks:
cmds:
- >
cargo clippy
{{.CLI_ARGS}}
--examples --tests --benches --bins --lib --workspace
-- -D clippy::pedantic -D clippy::dbg-macro -D warnings
Expand Down
134 changes: 67 additions & 67 deletions src/interpreter/stdlib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,80 +32,80 @@ mod tests {
const TWO: &str = "λa λb a (a b)";

#[rstest]
#[case::id(r#"id"#, "λa a")]
#[case::id(r"id", "λa a")]
// bool
#[case::true_repr(r#"true"#, T)]
#[case::false_repr(r#"false"#, F)]
#[case::not(r#"not true"#, F)]
#[case::not(r#"not false"#, T)]
#[case::and(r#"and false false"#, F)]
#[case::and(r#"and false true"#, F)]
#[case::and(r#"and true false"#, F)]
#[case::and(r#"and true true"#, T)]
#[case::or(r#"or false false"#, F)]
#[case::or(r#"or false true"#, T)]
#[case::or(r#"or true false"#, T)]
#[case::or(r#"or true true"#, T)]
#[case::xor(r#"xor false false"#, F)]
#[case::xor(r#"xor false true"#, T)]
#[case::xor(r#"xor true false"#, T)]
#[case::xor(r#"xor true true"#, F)]
#[case::xnor(r#"xnor false false"#, T)]
#[case::xnor(r#"xnor false true"#, F)]
#[case::xnor(r#"xnor true false"#, F)]
#[case::xnor(r#"xnor true true"#, T)]
#[case::true_repr(r"true", T)]
#[case::false_repr(r"false", F)]
#[case::not(r"not true", F)]
#[case::not(r"not false", T)]
#[case::and(r"and false false", F)]
#[case::and(r"and false true", F)]
#[case::and(r"and true false", F)]
#[case::and(r"and true true", T)]
#[case::or(r"or false false", F)]
#[case::or(r"or false true", T)]
#[case::or(r"or true false", T)]
#[case::or(r"or true true", T)]
#[case::xor(r"xor false false", F)]
#[case::xor(r"xor false true", T)]
#[case::xor(r"xor true false", T)]
#[case::xor(r"xor true true", F)]
#[case::xnor(r"xnor false false", T)]
#[case::xnor(r"xnor false true", F)]
#[case::xnor(r"xnor true false", F)]
#[case::xnor(r"xnor true true", T)]
// nat operations
#[case::inc(r#"eq (inc 0) 1"#, T)]
#[case::inc(r#"eq (inc 2) 3"#, T)]
#[case::add(r#"eq (add 2 3) 5"#, T)]
#[case::mul(r#"eq (mul 2 3) 6"#, T)]
#[case::pow(r#"eq (pow 3 2) 9"#, T)]
#[case::dec(r#"eq (dec 3) 2"#, T)]
#[case::dec(r#"eq (dec 0) 0"#, T)]
#[case::sub(r#"eq (sub 5 3) 2"#, T)]
#[case::sub(r#"eq (sub 3 5) 0"#, T)]
#[case::diff(r#"eq (diff 5 3) 2"#, T)]
#[case::diff(r#"eq (diff 3 5) 2"#, T)]
#[case::min(r#"eq (min 3 5) 3"#, T)]
#[case::min(r#"eq (min 5 3) 3"#, T)]
#[case::max(r#"eq (max 3 5) 5"#, T)]
#[case::max(r#"eq (max 5 3) 5"#, T)]
#[case::inc(r"eq (inc 0) 1", T)]
#[case::inc(r"eq (inc 2) 3", T)]
#[case::add(r"eq (add 2 3) 5", T)]
#[case::mul(r"eq (mul 2 3) 6", T)]
#[case::pow(r"eq (pow 3 2) 9", T)]
#[case::dec(r"eq (dec 3) 2", T)]
#[case::dec(r"eq (dec 0) 0", T)]
#[case::sub(r"eq (sub 5 3) 2", T)]
#[case::sub(r"eq (sub 3 5) 0", T)]
#[case::diff(r"eq (diff 5 3) 2", T)]
#[case::diff(r"eq (diff 3 5) 2", T)]
#[case::min(r"eq (min 3 5) 3", T)]
#[case::min(r"eq (min 5 3) 3", T)]
#[case::max(r"eq (max 3 5) 5", T)]
#[case::max(r"eq (max 5 3) 5", T)]
// nat comparison
#[case::is_zero(r#"is_zero 0"#, T)]
#[case::is_zero(r#"is_zero 1"#, F)]
#[case::eq(r#"eq 2 2"#, T)]
#[case::eq(r#"eq 2 3"#, F)]
#[case::eq(r#"eq 3 2"#, F)]
#[case::lt(r#"lt 2 5"#, T)]
#[case::lt(r#"lt 5 2"#, F)]
#[case::lt(r#"lt 2 2"#, F)]
#[case::gt(r#"gt 2 5"#, F)]
#[case::gt(r#"gt 5 2"#, T)]
#[case::gt(r#"gt 2 2"#, F)]
#[case::lte(r#"lte 2 5"#, T)]
#[case::lte(r#"lte 5 2"#, F)]
#[case::lte(r#"lte 2 2"#, T)]
#[case::gte(r#"gte 2 5"#, F)]
#[case::gte(r#"gte 5 2"#, T)]
#[case::gte(r#"gte 2 2"#, T)]
#[case::is_zero(r"is_zero 0", T)]
#[case::is_zero(r"is_zero 1", F)]
#[case::eq(r"eq 2 2", T)]
#[case::eq(r"eq 2 3", F)]
#[case::eq(r"eq 3 2", F)]
#[case::lt(r"lt 2 5", T)]
#[case::lt(r"lt 5 2", F)]
#[case::lt(r"lt 2 2", F)]
#[case::gt(r"gt 2 5", F)]
#[case::gt(r"gt 5 2", T)]
#[case::gt(r"gt 2 2", F)]
#[case::lte(r"lte 2 5", T)]
#[case::lte(r"lte 5 2", F)]
#[case::lte(r"lte 2 2", T)]
#[case::gte(r"gte 2 5", F)]
#[case::gte(r"gte 5 2", T)]
#[case::gte(r"gte 2 2", T)]
// rec
#[case::fac(r#"eq (fac 2) 2"#, T)]
#[case::fac(r#"eq (fac 3) 6"#, T)]
#[case::fac(r"eq (fac 2) 2", T)]
#[case::fac(r"eq (fac 3) 6", T)]
// #[case::fac(r#"eq (fac 4) (mul 6 4)"#, T)]
#[case::fib(r#"eq (fib 1) 1"#, T)]
#[case::fib(r#"eq (fib 2) 1"#, T)]
#[case::fib(r#"eq (fib 3) 2"#, T)]
#[case::fib(r#"eq (fib 4) 3"#, T)]
#[case::fib(r#"eq (fib 5) 5"#, T)]
#[case::fib(r"eq (fib 1) 1", T)]
#[case::fib(r"eq (fib 2) 1", T)]
#[case::fib(r"eq (fib 3) 2", T)]
#[case::fib(r"eq (fib 4) 3", T)]
#[case::fib(r"eq (fib 5) 5", T)]
// pair
#[case::car(r#"car (cons 1 2)"#, ONE)]
#[case::cdr(r#"cdr (cons 1 2)"#, TWO)]
#[case::car(r"car (cons 1 2)", ONE)]
#[case::cdr(r"cdr (cons 1 2)", TWO)]
// list
#[case::is_empty(r#"is_empty empty_list"#, T)]
#[case::is_empty(r#"is_empty (prepend empty_list 2)"#, F)]
#[case::head(r#"head (prepend empty_list 2)"#, TWO)]
#[case::tail(r#"is_empty (tail (prepend empty_list 2))"#, T)]
#[case(r#"head (prepend (prepend empty_list 3) 2)"#, TWO)]
#[case::is_empty(r"is_empty empty_list", T)]
#[case::is_empty(r"is_empty (prepend empty_list 2)", F)]
#[case::head(r"head (prepend empty_list 2)", TWO)]
#[case::tail(r"is_empty (tail (prepend empty_list 2))", T)]
#[case(r"head (prepend (prepend empty_list 3) 2)", TWO)]
fn stdlib(#[case] input: &str, #[case] exp: &str) {
let mut session = Session::new(None);
session.load_stdlib().unwrap();
Expand Down

0 comments on commit a1f0a61

Please sign in to comment.