-
Notifications
You must be signed in to change notification settings - Fork 439
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Hongbo Zhang
committed
Sep 9, 2016
1 parent
1f46d14
commit ca02cd2
Showing
8 changed files
with
213 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
'use strict'; | ||
|
||
var Bytes = require("../../lib/js/bytes"); | ||
var Mt = require("./mt"); | ||
var Block = require("../../lib/js/block"); | ||
var Caml_string = require("../../lib/js/caml_string"); | ||
|
||
var suites = [/* [] */0]; | ||
|
||
var test_id = [0]; | ||
|
||
function eq(loc, param) { | ||
var y = param[1]; | ||
var x = param[0]; | ||
test_id[0] = test_id[0] + 1 | 0; | ||
suites[0] = /* :: */[ | ||
/* tuple */[ | ||
loc + (" id " + test_id[0]), | ||
function () { | ||
return /* Eq */Block.__(0, [ | ||
x, | ||
y | ||
]); | ||
} | ||
], | ||
suites[0] | ||
]; | ||
return /* () */0; | ||
} | ||
|
||
var b = new Array(3); | ||
|
||
b[0] = /* "a" */97; | ||
|
||
b[1] = /* "b" */98; | ||
|
||
b[2] = /* "c" */99; | ||
|
||
Bytes.blit(b, 0, b, 1, 2); | ||
|
||
var res = Caml_string.bytes_to_string(b); | ||
|
||
console.log(res); | ||
|
||
eq('File "bytes_split_gpr_743.ml", line 17, characters 5-12', /* tuple */[ | ||
"aab", | ||
res | ||
]); | ||
|
||
var b$1 = new Array(3); | ||
|
||
b$1[0] = /* "a" */97; | ||
|
||
b$1[1] = /* "b" */98; | ||
|
||
b$1[2] = /* "c" */99; | ||
|
||
Bytes.blit(b$1, 1, b$1, 0, 2); | ||
|
||
var res2 = Caml_string.bytes_to_string(b$1); | ||
|
||
console.log(res2); | ||
|
||
eq('File "bytes_split_gpr_743.ml", line 32, characters 5-12', /* tuple */[ | ||
"bcc", | ||
res2 | ||
]); | ||
|
||
Mt.from_pair_suites("bytes_split_gpr_743.ml", suites[0]); | ||
|
||
exports.suites = suites; | ||
exports.test_id = test_id; | ||
exports.eq = eq; | ||
/* Not a pure module */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
let suites : Mt.pair_suites ref = ref [] | ||
let test_id = ref 0 | ||
let eq loc (x, y) = | ||
incr test_id ; | ||
suites := | ||
(loc ^" id " ^ (string_of_int !test_id), (fun _ -> Mt.Eq(x,y))) :: !suites | ||
|
||
|
||
let () = | ||
let b = Bytes.create 3 in | ||
Bytes.set b 0 'a'; | ||
Bytes.set b 1 'b'; | ||
Bytes.set b 2 'c'; | ||
Bytes.blit b 0 b 1 2; | ||
let res = (Bytes.unsafe_to_string b) in | ||
Js.log res; (* "aab"*) | ||
eq __LOC__ ("aab", res) | ||
(* assert('a' = Bytes.get b 0); *) | ||
(* assert('a' = Bytes.get b 1); *) | ||
(* assert('b' = Bytes.get b 2); *) | ||
(* () *) | ||
|
||
|
||
let () = | ||
let b = Bytes.create 3 in | ||
Bytes.set b 0 'a'; | ||
Bytes.set b 1 'b'; | ||
Bytes.set b 2 'c'; | ||
Bytes.blit b 1 b 0 2; | ||
let res2 = (Bytes.unsafe_to_string b) in | ||
Js.log res2 (* "bcc"*); | ||
eq __LOC__ ("bcc", res2) | ||
|
||
|
||
let () = Mt.from_pair_suites __FILE__ !suites |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters