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:
parent
e06204a641
commit
c5008cdb5d
|
@ -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 [
|
||||
[[], []]
|
||||
|
|
Loading…
Reference in New Issue