-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.js
30 lines (25 loc) · 919 Bytes
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
const test = require("ava");
const serialize_basic_csv = require("./serialize_basic_csv");
const serialize_advanced_csv = require("./serialize_advanced_csv");
const deserialize_basic_csv = require("./deserialize_basic_csv");
const deserialize_advanced_csv = require("./deserialize_advanced_csv");
test("basic csv serialization", t => {
const data = [5, 3, 1, 8, 2, 0];
const csv = serialize_basic_csv(data);
t.is(csv, "5,3,1,8,2,0");
});
test("advanced csv serialization", t => {
const data = [5, 3, 1, 8, 2, 0];
const csv = serialize_advanced_csv(data);
t.is(csv, "3x5,8,0x2");
});
test("basic csv deserialization", t => {
const csv = "5,3,1,8,2,0";
const data = deserialize_basic_csv(csv);
t.deepEqual(data, [5, 3, 1, 8, 2, 0]);
});
test("advanced csv deserialization", t => {
const csv = "3x5,8,0x2";
const data = deserialize_advanced_csv(csv);
t.deepEqual(data, [5, 3, 1, 8, 2, 0]);
});