Skip to content

Instantly share code, notes, and snippets.

@kpmy
Created May 24, 2016 21:44
Show Gist options
  • Save kpmy/12b9310905a82bcb10abb6b6bfcefb8d to your computer and use it in GitHub Desktop.
Save kpmy/12b9310905a82bcb10abb6b6bfcefb8d to your computer and use it in GitHub Desktop.
function UnitTest(rts) {
const mod = this;
mod.ImportLog = rts.load("Log");
mod.ImportTest0 = rts.load("Test0");
mod.$w = new rts.Obj(new rts.Type("ANY"));
mod.$x = new rts.Obj(new rts.Type("ANY"));
mod.$y = new rts.Obj(new rts.Type("ANY"));
mod.$z = new rts.Obj(new rts.Type("ANY"));
mod.$ret = new rts.Obj(new rts.Type("ANY"));
mod.$Do = function () {
console.log("enter Test.Do");
console.dir(arguments, {depth: null});
var $i = new rts.Obj(new rts.Type("ANY"));
var $j = new rts.Obj(new rts.Type("ANY"));
var $k = new rts.Obj(new rts.Type("ANY"));
mod.$y.value = (new rts.Value("INTEGER", 1));
$i.value = (new rts.Value("INTEGER", 10));
(mod.ImportTest0.$Do());
$j.value = (rts.copyOf(mod.ImportTest0.$j.value));
$k.value = (rts.copyOf($j.value));
};
mod.$Do0 = function () {
console.log("enter Test.Do0");
console.dir(arguments, {depth: null});
var $a = new rts.Obj(new rts.Type("ANY"));
var $i = new rts.Obj(new rts.Type("INTEGER"));
var $b = new rts.Obj(new rts.Type("BOOLEAN"));
$a.value = (new rts.Value("ANY", global.NONE));
$i.value = (new rts.Value("INTEGER", 1945));
$b.value = (new rts.Value("BOOLEAN", true));
mod.$z.value = (new rts.Value("ANY", global.NONE));
(mod.$Do1());
};
mod.$Do1 = function () {
console.log("enter Test.Do1");
console.dir(arguments, {depth: null});
};
mod.$Do2 = function () {
console.log("enter Test.Do2");
console.dir(arguments, {depth: null});
var $i = new rts.Obj(new rts.Type("INTEGER"));
var $j = new rts.Obj(new rts.Type("INTEGER"));
var $k = new rts.Obj(new rts.Type("INTEGER"));
$i.value = arguments[0];
$j.value = arguments[1];
mod.$ret.value = (rts.copyOf($j.value));
};
mod.start = function () {
console.log('dynamic load Test');
mod.$x.value = (new rts.Value("INTEGER", 1984));
(mod.$Do());
mod.ImportTest0.$i.value = (new rts.Value("INTEGER", 1));
mod.$z.value = (rts.copyOf(mod.$x.value));
mod.$w.value = (rts.copyOf(mod.ImportTest0.$j.value));
(mod.$Do0());
(mod.$Do2((new rts.Value("INTEGER", 0)),
(new rts.Value("INTEGER", 1)),
(new rts.Value("INTEGER", 2)),
(new rts.Value("INTEGER", 3))));
};
};
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