This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (def gray 0) | |
| (def black 1) | |
| (def white 2) | |
| (defn board [size] (vec (repeat * size size) gray)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # ! | |
| return (a > b) | |
| # !! | |
| if (a > b) | |
| return true | |
| else | |
| return false | |
| # !!! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash -x | |
| source ~/.bashrc | |
| rvm use 1.9.2@project | |
| bundle install | |
| rake db:migrate | |
| rake spec | |
| HEADLESS=true rake cucumber |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # add this code to "features/support/env.rb" | |
| if ENV['HEADLESS'] == 'true' | |
| require 'headless' | |
| headless = Headless.new | |
| headless.start | |
| at_exit do | |
| headless.destroy | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # install Firefox, or any other browser under testing | |
| apt-get install firefox | |
| # install Xvfb | |
| apt-get install xvfb | |
| # boost X11 server | |
| Xvfb :99 -ac -screen 0 1024x768x16 | |
| # set up environmental variable | |
| export DISPLAY=:99 | |
| # launch Firefox | |
| firefox |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (defmacro- make-command [name block] | |
| `(defn ~(symbol name) [& args#] | |
| (if args# (~block args#) (~block)))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (ns gtp.example.console | |
| (:refer-clojure :exclude [name]) | |
| (:require [gtp.core :as gtp] :reload) | |
| (:gen-class)) | |
| (defn board [] | |
| (let [size (atom 19)] | |
| {:set-size #(reset! size %1) | |
| :get-size @size})) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module UI.TestMenu where | |
| import TestHelper | |
| import HUnit.HUnit | |
| import UI.Menu as Menu | |
| gets move = return move | |
| testAskMove = TestCase (do move <- askMove $ gets 0 | |
| assertEqual "should return 0," 0 move) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module UI.TestMenu where | |
| import TestHelper | |
| import HUnit.HUnit | |
| import UI.Menu as Menu | |
| mockBoard = "+++++++++" | |
| mockFormatBoard board = board | |
| testPrint expected actual = expected == actual |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module UI.Menu (putBoard) where | |
| -- putBoard format board = putStr $ format board | |
| putBoard puts format board = puts $ format board | |
| -- askMove = return =<< getLine | |
| askMove gets = return =<< gets |