forked from rescript-lang/rescript
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuffer_test.js
102 lines (94 loc) · 1.95 KB
/
buffer_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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
// Generated CODE, PLEASE EDIT WITH CARE
'use strict';
var Assert = require("assert");
var Bytes = require("../stdlib/bytes");
var Caml_builtin_exceptions = require("../runtime/caml_builtin_exceptions");
var Mt = require("./mt");
var Buffer = require("../stdlib/buffer");
var v = "gso";
function bytes_equal() {
if (Bytes.make(3, /* "a" */97)[0] !== /* "a" */97) {
throw [
0,
Caml_builtin_exceptions.Assert_failure,
[
0,
"buffer_test.ml",
9,
4
]
];
}
if (Bytes.make(3, /* "a" */97)[0] !== /* "a" */97) {
throw [
0,
Caml_builtin_exceptions.Assert_failure,
[
0,
"buffer_test.ml",
10,
4
]
];
}
var u = Bytes.make(3, /* "a" */97);
u[0] = /* "b" */98;
if (u[0] !== /* "b" */98) {
throw [
0,
Caml_builtin_exceptions.Assert_failure,
[
0,
"buffer_test.ml",
13,
4
]
];
}
if (v[0] === "g") {
return 0;
}
else {
throw [
0,
Caml_builtin_exceptions.Assert_failure,
[
0,
"buffer_test.ml",
14,
4
]
];
}
}
var suites_001 = [
/* tuple */0,
"equal",
bytes_equal
];
var suites_002 = [
/* :: */0,
[
/* tuple */0,
"buffer",
function () {
var v = Buffer.create(30);
for(var i = 0; i<= 10; ++i){
Buffer.add_string(v, "" + i);
}
var prim = Buffer.contents(v);
return Assert.deepEqual(prim, "012345678910");
}
],
/* [] */0
];
var suites = [
/* :: */0,
suites_001,
suites_002
];
Mt.from_suites("buffer_test.ml", suites);
exports.v = v;
exports.bytes_equal = bytes_equal;
exports.suites = suites;
/* Not a pure module */