[go: nahoru, domu]

Skip to content

Commit

Permalink
modified test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
brigadir committed Dec 7, 2017
1 parent 577d57c commit 9a74200
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 52 deletions.
41 changes: 41 additions & 0 deletions tests/easyoop.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3511,6 +3511,47 @@ if (typeof(zebkit) === "undefined") {
zebkit.getPropertySetter(dd, "abc");
}
console.log("Property setter result : " + (new Date().getTime() - d));
},

function test_properties() {
var cc = 0,
target = { a: 10, b: 20, c: 700, setC : function(c) { this.c = c }, e: 333, complex: {
setA: function(a) { this.a = a; },
b : "",
c : null
}},

props = { a: 70,
b: 90,
c: 400,
d : { "$new": function() { return ++cc; } },
"-e":null,
"complex/" : {
a: 342,
b: "abc",
c: 10
}
};

var r = zebkit.properties(target, props);
assert(r.a, 70, "test_properties 1");
assert(r.b, 90, "test_properties 2");
assert(r.c, 400, "test_properties 3");
assert(r.d, 1, "test_properties 4");
assert(r.e, undefined, "test_properties 41");
assert(r.complex.a, 342, "test_properties 42");
assert(r.complex.b, "abc", "test_properties 43");
assert(r.complex.c, 10, "test_properties 44");
assert(typeof r.setC === 'function', true, "test_properties 5");


var r = zebkit.properties(target, props);
assert(r.a, 70, "test_properties 6");
assert(r.b, 90, "test_properties 7");
assert(r.c, 400, "test_properties 8");
assert(r.d, 2, "test_properties 9");
assert(r.e, undefined, "test_properties 91");
assert(typeof r.setC === 'function', true, "test_properties 10");
}
);
})();
33 changes: 25 additions & 8 deletions tests/util.listeners.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -897,7 +897,6 @@ zebkit.runTests("Util Listeners",
r.fire("fired2", [ 1, 2 ]);
}, Error);


assert(cnt, 3);
r.off(obj);
cnt = 0;
Expand All @@ -915,10 +914,10 @@ zebkit.runTests("Util Listeners",

cnt = 0;
r.on("fired", function() { cnt+=5; });
r.fire();
r.fire("fired", r);
assert(cnt, 5);
r.off("fired");
r.fire();
r.fire("fired", r);
assert(cnt, 5);
},

Expand All @@ -933,15 +932,33 @@ zebkit.runTests("Util Listeners",
//c1.event3();
c2.fired();
}

console.log(">>> " + (new Date().getTime() - t1));

var t2 = new Date().getTime();
// for(var i=0; i < 10000000; i++) {
//c1.event1();
//}
//console.log(">>> " + (new Date().getTime() - t));
for(var i=0; i < 10000000; i++) {
c1.event1();
}
console.log(">>> " + (new Date().getTime() - t2));

var L1 = Class(zebkit.EventProducer, []).events("a1", "a2"), l1 = new L1();
var L2 = Class(zebkit.EventProducer, []).events("a1"), l2 = new L2();

l1.on("a1", function() {});
l2.on(function() {});


var t1 = new Date().getTime();
for(var i=0; i < 10000000; i++) {
//c1.event3();
l1.fire("a1", [1,2,3]);
}
console.log(">>> " + (new Date().getTime() - t1));

var t2 = new Date().getTime();
for(var i=0; i < 10000000; i++) {
l2.fire("a1", [1,2,3]);
}
console.log(">>> " + (new Date().getTime() - t2));
}
);

Expand Down
3 changes: 0 additions & 3 deletions tests/util.tree.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,6 @@ zebkit.runTests("Util",
}, Error);

zebkit.findInTree(treeLikeRoot, "//Root/a/*", function() {}, function() {});

zebkit.findInTree(treeLikeRoot, "//*[@id='dsds/sds']", function() {}, function() {});
},

function test_treelookup() {
Expand All @@ -105,7 +103,6 @@ zebkit.runTests("Util",
return false;
};


res = [];
zebkit.findInTree(treeLikeRoot, ".//*", collect);
assert(res.length, 7, "-100");
Expand Down
41 changes: 0 additions & 41 deletions tests/zson.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -976,47 +976,6 @@ zebkit.runTests("util objects bag",
}).catch();
},

function test_test() {
A = Class([
function setA(a) {
this.a = a;
}
])

B = Class([
function setM(m) {
this.m = m;
}
])

var z1 = `{
"variables" : {
"id" : "MyID"
}
}
`;

var z2 = `{
"@A": [],
"id" : "%{id}"
}
`;

// Zson.then(z1, function(zson) {
// var zs = new Zson(zson.root);
// zs.usePropertySetters = false;
// zs.then(z2, function(zson_) {
// zson.root; // get result here
// }).catch();
// }).catch();

var zs = new Zson();
// zs.$variables = { id2 : 333333 };
zs.then("http://localhost:8090/tests/defs.json?test=312323", function(zson) {

}).catch();

},

function test_prom() {
var rr = null, p = new Promise(function(resolve, reject) {
Expand Down

0 comments on commit 9a74200

Please sign in to comment.