From c5008cdb5d175fd912a5b70963e4ad772f797f73 Mon Sep 17 00:00:00 2001 From: "Elf M. Sternberg" Date: Tue, 23 Jun 2015 07:35:06 -0700 Subject: [PATCH] Added fundamental traversal tests. They passed (of course, otherwise many other things would already be failing), but I can't believe I forgot them. Some TDD'r I am. --- test/lists.coffee | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/test/lists.coffee b/test/lists.coffee index 589d1fa..a60d7cb 100644 --- a/test/lists.coffee +++ b/test/lists.coffee @@ -2,7 +2,8 @@ chai = require 'chai' chai.should() expect = chai.expect -{listToVector, vectorToList, cons, list, nil, metacadr} = require '../src/lists' +{listToVector, vectorToList, cons, list, nil, + metacadr, car, cdr, cadr} = require '../src/lists' describe "Basic list building", -> for [t, v] in [ @@ -15,6 +16,16 @@ describe "Basic list building", -> it "should match #{t}", -> expect(t).to.deep.equal(v) +mcsimple = cons('a', cons('b', cons('c'))) + +describe "Basic list traversing", -> + it "should car", -> + expect(car mcsimple).to.equal("a") + it "should cadr", -> + expect(cadr mcsimple).to.equal("b") + it "should car cdr cdr", -> + expect(car cdr cdr mcsimple).to.equal("c") + describe 'Round trip equivalence', -> for [t, v] in [ [[], []]