summaryrefslogtreecommitdiff
path: root/src/lib/types.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/types.rs')
-rw-r--r--src/lib/types.rs43
1 files changed, 0 insertions, 43 deletions
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<SEXP>)
-}
-
-#[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")
- }
-}