Commit 48f27d3b authored by Linshizhi's avatar Linshizhi

update unittest

parent 9281237d
......@@ -9,8 +9,10 @@ export class ParaEncoder {
/* */
constructor(numOfTR, codec) {
assert(typeof(numOfTR) == 'number');
assert(typeof(codec) == 'string');
assert(typeof(numOfTR) == 'number',
"typeof(numOfTR) == 'number' failed");
assert(typeof(codec) == 'string',
"typeof(codec) == 'number' failed");
this.numOfTR = numOfTR;
this.codec = codec;
......
......@@ -2,6 +2,6 @@
export function assert(expr, message) {
if (!expr) {
throw message || "Assertion failed";
throw new Error(message || 'Assertion failed');
}
}
import "../src/paraEncode";
import { ParaEncoder } from "../src/paraEncode";
describe("A suite", function() {
it("contain spec with an expectation", function() {
expect(true).toBe(true);
});
test('ParaEncoder Normal Init', () => {
let dut = new ParaEncoder(1, "h264");
expect(dut.numOfTR).toBe(1);
expect(dut.codec).toBe("h264");
});
test("ParaEncoder Invalid Init", () => {
try {
new ParaEncoder(1, 1);
} catch (err) {
expect(err.message)
.toBe("typeof(codec) == 'number' failed");
}
})
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment