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.
This commit is contained in:
Elf M. Sternberg 2015-06-23 07:35:06 -07:00
parent e06204a641
commit c5008cdb5d
1 changed files with 12 additions and 1 deletions

View File

@ -2,7 +2,8 @@ chai = require 'chai'
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}", ->
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 [
[[], []]