Created
October 2, 2015 02:49
-
-
Save shunjikonishi/19a8aaed4577389df9e0 to your computer and use it in GitHub Desktop.
This file contains 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
var assert = require("chai").assert; | |
var codecheck = require("codecheck"); | |
var expected = []; | |
for (var i=1; i<= 100; i++ ) { | |
if(i % 15 == 0) expected.push("FizzBuzz"); | |
else if (i % 5 == 0) expected.push("Buzz"); | |
else if (i % 3 == 0) expected.push("Fizz"); | |
else expected.push("" + i); | |
} | |
function doTest(arg, expected, done) { | |
var app = codecheck.consoleApp("./a.out"); | |
app.expected("" + expected); | |
app.runAndVerify([arg], function(result) { | |
assert(result.succeed, result.getMessage()); | |
done(); | |
}); | |
} | |
describe("isFizzbuzz", function() { | |
expected.forEach(function(value, index) { | |
it("Test " + (index + 1) + " returns " + value, function(done) { | |
doTest(index + 1, value, done); | |
}) | |
}); | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment