Commit 01e1ab88 authored by NzSN's avatar NzSN

Add Unittests.

parent 945aac1a
......@@ -68,6 +68,12 @@ describe("Channel Spec", () => {
let ret = channel.push(buffer);
expect(ret).toBe(true);
// Try to write a byte to full channel
// , should fail.
ret = channel.push(new Uint8Array([1]));
expect(ret).toBe(false);
let readData = channel.readData(1023);
expect(areEqual(buffer, readData))
.withContext("Data Mismatch")
......@@ -96,6 +102,24 @@ describe("Channel Spec", () => {
expect(channel.isEmpty()).toBe(true);
})
it("2 Bytes Channel", () => {
let channel = new Channel(WW, 2, ArrayBuffer);
let buffer = new Uint8Array([3]);
let ret = channel.push(buffer);
expect(ret).toBe(true);
// Push should be failed cause
// there are no more space.
ret = channel.push(buffer);
expect(ret).toBe(false);
let data = channel.readData(1);
expect(areEqual(buffer, data)).toBe(true);
expect(channel.isEmpty()).toBe(true);
});
});
describe("H264EncWWGroup Spec", () => {
......
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