From ad9f7e6a689c7fe42444cbe22ecdf1de8d092d5b Mon Sep 17 00:00:00 2001 From: Dominick Allen Date: Fri, 26 Jun 2020 21:12:16 -0500 Subject: Evaluate basic arithmetic. --- src/lib/types.rs | 43 ------------------------------------------- 1 file changed, 43 deletions(-) (limited to 'src/lib/types.rs') diff --git a/src/lib/types.rs b/src/lib/types.rs index 4c2900a..7755c04 100644 --- a/src/lib/types.rs +++ b/src/lib/types.rs @@ -51,47 +51,4 @@ pub enum Type { Operator(Op), } -#[derive(PartialEq, Debug)] -pub enum SEXP { - Atom(Type), - Sexpr(Vec) -} - -#[test] -fn construct() { - let atom1 = SEXP::Atom(Type::Number(Number::Int(1))); - let atom2 = SEXP::Atom(Type::Number(Number::Int(2))); - let atom3 = SEXP::Atom(Type::Number(Number::Int(3))); - let atom4 = SEXP::Atom(Type::Number(Number::Int(4))); - let sexp = SEXP::Sexpr(vec!(atom1, atom2, atom3, atom4)); - match sexp { - SEXP::Sexpr(ref x) => { - assert_eq!(x[0], SEXP::Atom(Type::Number(Number::Int(1)))); - }, - _ => panic!("What") - } -} - -#[test] -fn mutability() { - let atom1 = SEXP::Atom(Type::Number(Number::Int(1))); - let atom2 = SEXP::Atom(Type::Number(Number::Int(2))); - let atom3 = SEXP::Atom(Type::Number(Number::Int(3))); - let atom4 = SEXP::Atom(Type::Number(Number::Int(4))); - let mut sexp = SEXP::Sexpr(vec!(atom1, atom2, atom3, atom4)); - match sexp { - SEXP::Sexpr(ref mut x) => match x[0] { - SEXP::Atom(Type::Number(Number::Int(ref mut x))) => *x += 7, - _ => panic!("What") - }, - _ => panic!("What") - } - - match sexp { - SEXP::Sexpr(ref x) => { - assert_eq!(x[0], SEXP::Atom(Type::Number(Number::Int(8)))); - }, - _ => panic!("What") - } -} -- cgit v1.2.3