fix asciilib tests
This commit is contained in:
@@ -16,7 +16,7 @@
|
|||||||
(method _index [x y]
|
(method _index [x y]
|
||||||
(+ x (* y width)))
|
(+ x (* y width)))
|
||||||
|
|
||||||
(defmacro withIndex [idxName xName yName &body body]
|
(defMacro withIndex [idxName xName yName &body body]
|
||||||
`(let [,idxName (_index ,xName ,yName)]
|
`(let [,idxName (_index ,xName ,yName)]
|
||||||
,@body))
|
,@body))
|
||||||
|
|
||||||
|
@@ -59,16 +59,15 @@
|
|||||||
((Some colorLine)
|
((Some colorLine)
|
||||||
(let [[symbol _r _g _b] (colorLine.split " ")]
|
(let [[symbol _r _g _b] (colorLine.split " ")]
|
||||||
(dictSet colors symbol (object r (Std.parseInt _r) g (Std.parseInt _g) b (Std.parseInt _b)))))
|
(dictSet colors symbol (object r (Std.parseInt _r) g (Std.parseInt _g) b (Std.parseInt _b)))))
|
||||||
(None (throw "Expected INFO CODES in Surface"))))
|
(otherwise (throw "Expected INFO CODES in Surface"))))
|
||||||
(loop
|
(loop
|
||||||
(case (stream.takeLine)
|
(case (stream.takeLine)
|
||||||
((Some "SIZE") (break))
|
((Some "SIZE") (break))
|
||||||
((Some infoLine)
|
((Some infoLine)
|
||||||
(let [infoTokens (infoLine.split " ")]
|
(let [infoTokens (infoLine.split " ")]
|
||||||
(dictSet infoCodes (infoTokens.shift) (infoTokens.join " "))))
|
(dictSet infoCodes (infoTokens.shift) (infoTokens.join " "))))
|
||||||
(None (throw "Expected SIZE in Surface"))))
|
(otherwise (throw "Expected SIZE in Surface"))))
|
||||||
(case (stream.takeLine)
|
(case (stream.takeLine)
|
||||||
(None (throw "expected [width] [height] in Surface"))
|
|
||||||
((Some sizeLine)
|
((Some sizeLine)
|
||||||
(let [[width height] (.map (sizeLine.split " ") Std.parseInt)
|
(let [[width height] (.map (sizeLine.split " ") Std.parseInt)
|
||||||
surface (new Surface width height)]
|
surface (new Surface width height)]
|
||||||
@@ -95,4 +94,5 @@
|
|||||||
(doFor x (range width)
|
(doFor x (range width)
|
||||||
(surface.specialInfo.setCell x y (dictGet infoCodes (stream.expect "a special info code" ->{(stream.takeChars 1)}))))
|
(surface.specialInfo.setCell x y (dictGet infoCodes (stream.expect "a special info code" ->{(stream.takeChars 1)}))))
|
||||||
(stream.dropString "\n"))
|
(stream.dropString "\n"))
|
||||||
surface)))))
|
surface))
|
||||||
|
(otherwise (throw "expected [width] [height] in Surface")))))
|
||||||
|
Reference in New Issue
Block a user