Skip to content
This repository was archived by the owner on Feb 11, 2021. It is now read-only.

Commit fc653d6

Browse files
committed
Add test cases
1 parent cf69b51 commit fc653d6

File tree

3 files changed

+28
-1
lines changed

3 files changed

+28
-1
lines changed

codecheck.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
build:
2-
- c++ -o theapp.o src/*.cpp
2+
- c++ -o theapp.o "src/*.cpp"
33
env:
44
APP_COMMAND: ./theapp.o
55
test: mocha

test/cases.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[
2+
{ "it": "hoge ->-> hoge",
3+
"input": ["hoge"], "output": ["hoge"]},
4+
{ "it": "hoge, fuga ->-> hoge, fuga",
5+
"input": ["hoge", "fuga"], "output": ["hoge", "fuga"]},
6+
{ "it": "hoge fuga ->-> hoge fuga",
7+
"input": ["hoge fuga"], "output": ["hoge fuga"]}
8+
]

test/test.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
"use strict";
2+
3+
const assert = require("chai").assert;
4+
const codecheck = require("codecheck");
5+
const app = codecheck.consoleApp(process.env.APP_COMMAND);
6+
7+
describe("Echo", function() {
8+
let cases = require("./cases.json");
9+
cases.forEach(v => {
10+
let desc = v.it || `${v.input.join(", ")} ->-> ${v.output.join(", ")}`;
11+
it(desc, () => {
12+
return app.codecheck(v.input).then(result => {
13+
assert.equal(result.code, 0);
14+
assert.deepEqual(result.stdout, v.output);
15+
});
16+
});
17+
});
18+
});
19+

0 commit comments

Comments
 (0)