-- Copyright © 2014 Garrison Jensen
-- License
-- This code and text are dedicated to the public domain.
-- You can copy, modify, distribute and perform the work,
-- even for commercial purposes, all without asking permission.

import Test.HUnit
import Parser
import Nock
import Interpreter

main = do
    assertEqual "Atom: " (Atom 1) $ nock $ parseString "1"
    assertEqual "Atom: " (Atom 42) $ nock $ parseString "42"
    assertEqual "Increment: " (Atom 43) $ nock $ parseString "[42 [4 0 1]]" 
    assertEqual "Increment: " (Atom 667) $ nock $ parseString "[666 [4 0 1]]"
    assertEqual "Decrement: " (Atom 41) $ nock $ parseString "[42 [8 [1 0] 8 [1 6 [5 [0 7] 4 0 6] [0 6] 9 2 [0 2] [4 0 6] 0 7] 9 2 0 1]]"
    assertEqual "Decrement: " (Atom 7776) $ nock $ parseString "[7777 [8 [1 0] 8 [1 6 [5 [0 7] 4 0 6] [0 6] 9 2 [0 2] [4 0 6] 0 7] 9 2 0 1]]"
    assertEqual "Addressing: " (Cell (Atom 14) (Atom 15)) $ nock $ parseString "[[[4 5] [6 14 15]] [0 7]]" 
    assertEqual "Addressing: " (Cell (Atom 4) (Atom 5)) $ nock $ parseString "[[[4 5] [6 14 15]] 0 2]"
