Permalink
Browse files

dasm16 extension for github syntax highlighting

  • Loading branch information...
jaspervdj committed Apr 12, 2012
1 parent f21d31e commit 7598f083fa6ba88b72f7896bd14b705474a01d25
View
@@ -27,7 +27,7 @@ Building
Running
-------
./dist/build/dcpu16-assembler/dcpu16-assembler examples/notch.s
./dist/build/dcpu16-assembler/dcpu16-assembler examples/notch.dasm16
This produces `a.out`.
File renamed without changes.
File renamed without changes.
File renamed without changes.
View
Binary file not shown.
File renamed without changes.
View

This file was deleted.

Oops, something went wrong.
File renamed without changes.
File renamed without changes.
View
@@ -21,26 +21,26 @@ import Memory (Address (..), Register (..))
tests :: Test
tests = testGroup "Examples"
[ testCase "notch.s" $ example "examples/notch.s" $ do
[ testExample "notch" $ do
x <- load $ Register X
cycles <- load Cycles
return $ (0x40, 106) @=? (x, cycles)
, testCase "sum-squares.s" $ example "examples/sum-squares.s" $ do
, testExample "sum-squares" $ do
x <- load $ Register X
return $ sum [n * n | n <- [0 .. 50]] @=? x
, testCase "bubble-sort.s" $ example "examples/bubble-sort.s" $ do
, testExample "bubble-sort" $ do
xs <- forM [0 .. 9] $ load . Ram . (0x1000 +)
return $ sort xs @=? xs
, testCase "32-bit-add.s" $ example "examples/32-bit-add.s" $ do
, testExample "32-bit-add" $ do
lo <- load $ Ram 0x1000
hi <- load $ Ram 0x1001
let sum' = (fromIntegral hi `shiftL` 16) + fromIntegral lo :: Int
return $ 0x12345678 + 0xaabbccdd @=? sum'
, testCase "fib.s" $ example "examples/fib.s" $ do
, testExample "fib" $ do
let fibs = 1 : 2 : zipWith (+) fibs (tail fibs)
addrs = [0xffff, 0xfffe .. 0x000c]
@@ -52,7 +52,7 @@ tests = testGroup "Examples"
return . assert =<< loop fibs addrs
, testCase "self-copy.s" $ example "examples/self-copy.s" $ do
, testExample "self-copy" $ do
let readRam i = do
x <- load $ Ram i
if x == 0x0000
@@ -68,6 +68,13 @@ tests = testGroup "Examples"
return $ assert $ equal programs
]
testExample :: String
-> (forall s. STEmulator s Assertion)
-> Test
testExample name = testCase name .
example ("examples/" ++ name ++ ".dasm16")
example :: FilePath
-> (forall s. STEmulator s Assertion)
-> Assertion

0 comments on commit 7598f08

Please sign in to comment.