Created
June 1, 2016 21:53
-
-
Save kpmy/50bc754a9b744e03216d05a1d7ab9b75 to your computer and use it in GitHub Desktop.
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
function UnitTest(rts) { | |
const mod = this; | |
mod.$bool = new rts.Obj(new rts.Type("BOOLEAN")); | |
mod.$int = new rts.Obj(new rts.Type("INTEGER")); | |
mod.$any = new rts.Obj(new rts.Type("ANY")); | |
mod.$a0 = new rts.Obj(new rts.Type("ANY")); | |
mod.$a1 = new rts.Obj(new rts.Type("ANY")); | |
mod.$str = new rts.Obj(new rts.Type("STRING")); | |
mod.$ch = new rts.Obj(new rts.Type("CHAR")); | |
mod.$ch0 = new rts.Obj(new rts.Type("CHAR")); | |
mod.$map = new rts.Obj(new rts.Type("MAP")); | |
mod.$map0 = new rts.Obj(new rts.Type("MAP")); | |
mod.$list = new rts.Obj(new rts.Type("LIST")); | |
mod.$proc = new rts.Obj(new rts.Type("BLOCK")); | |
mod.$Do0 = function() { | |
console.log("enter Test.Do0"); | |
console.dir(arguments, { | |
depth: null | |
}); | |
var $x = new rts.Obj(new rts.Type("INTEGER")); | |
$x.value((new rts.Value("INTEGER", 1933, "utf8"))); | |
console.log("leave Test.Do0"); | |
}; | |
mod.start = function() { | |
console.log('dynamic load Test'); | |
mod.$bool.value((new rts.Value("BOOLEAN", true, "utf8"))); | |
mod.$int.value((new rts.Value("INTEGER", 140, "utf8"))); | |
mod.$any.value((rts.copyOf(mod.$int.value()))); | |
mod.$str.value((new rts.Value("STRING", `SGVsbG8sIFdvcmxkIQ==`, "base64"))); | |
mod.$ch.value((new rts.Value("CHAR", 33, "charCode"))); | |
mod.$map.value((new rts.Value("MAP", [ | |
[(new rts.Value("STRING", `aGVsbG8=`, "base64")), (new rts.Value("STRING", `d29ybGQ=`, "base64"))], | |
[(new rts.Value("STRING", `aGk=`, "base64")), (new rts.Value("INTEGER", 1, "utf8"))], | |
[(new rts.Value("STRING", `Ynll`, "base64")), (rts.copyOf(mod.$int.value()))] | |
]))); | |
mod.$list.value((new rts.Value("LIST", [(new rts.Value("STRING", `aGVsbG8=`, "base64")), | |
(new rts.Value("STRING", `d29ybGQ=`, "base64")), | |
(new rts.Value("STRING", `aGk=`, "base64")), | |
(new rts.Value("INTEGER", 1, "utf8")), | |
(new rts.Value("STRING", `Ynll`, "base64")), | |
(rts.copyOf(mod.$int.value())) | |
]))); | |
mod.$ch0.value((rts.copyOf(mod.$str.select((new rts.Value("INTEGER", 0, "utf8"))).value()))); | |
mod.$str.select((new rts.Value("INTEGER", 0, "utf8"))).value((rts.copyOf(mod.$str.select((new rts.Value("INTEGER", 1, "utf8"))).value()))); | |
mod.$a0.value((rts.copyOf(mod.$list.select((new rts.Value("INTEGER", 4, "utf8"))).value()))); | |
mod.$list.select((new rts.Value("INTEGER", 0, "utf8"))).value((rts.copyOf(mod.$a0.value()))); | |
mod.$a1.value((rts.copyOf(mod.$map.select((new rts.Value("STRING", `aGk=`, "base64"))).value()))); | |
mod.$map.select((new rts.Value("STRING", `Ynll`, "base64"))).value((rts.copyOf(mod.$int.value()))); | |
mod.$map0.value((new rts.Value("MAP", [ | |
[(new rts.Value("STRING", `bGlzdA==`, "base64")), (new rts.Value("LIST", [(new rts.Value("INTEGER", 0, "utf8")), | |
(new rts.Value("INTEGER", 1, "utf8")), | |
(new rts.Value("INTEGER", 2, "utf8")), | |
(new rts.Value("INTEGER", 3, "utf8")) | |
]))] | |
]))); | |
mod.$proc.value((new rts.Value("BLOCK", mod.$Do0))); | |
mod.$proc.call(); | |
}; | |
}; | |
module.exports = function(rts) { | |
return new UnitTest(rts) | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment