diff options
author | Andrew Tridgell <tridge@samba.org> | 2005-07-11 00:23:57 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:19:33 -0500 |
commit | f9ff72cbda6b4e59448fd79ef9e12f264d48015f (patch) | |
tree | d0bff5e1f6ae70bb9ba3ec563c7ed03cf0cc5fa2 /source4/scripting/libjs/base.js | |
parent | b2f132182174d13c8bcb535f62522687675947c2 (diff) | |
download | samba-f9ff72cbda6b4e59448fd79ef9e12f264d48015f.tar.gz samba-f9ff72cbda6b4e59448fd79ef9e12f264d48015f.tar.bz2 samba-f9ff72cbda6b4e59448fd79ef9e12f264d48015f.zip |
r8298: - started building a library of js routines in scripting/libjs/
- switched the existing test programs over to using the library
- added install of js lib
(This used to be commit 2a444dedbe44347268affc6458196f93ca7d372b)
Diffstat (limited to 'source4/scripting/libjs/base.js')
-rw-r--r-- | source4/scripting/libjs/base.js | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/source4/scripting/libjs/base.js b/source4/scripting/libjs/base.js new file mode 100644 index 0000000000..504cd82259 --- /dev/null +++ b/source4/scripting/libjs/base.js @@ -0,0 +1,53 @@ +/* + base js library functions + Copyright Andrew Tridgell 2005 + released under the GNU GPL v2 or later +*/ + +if (global["HAVE_BASE_JS"] != undefined) { + return; +} +HAVE_BASE_JS=1 + +/* + helper function to setup a rpc io object, ready for input +*/ +function irpcObj() +{ + var o = new Object(); + o.input = new Object(); + return o; +} + +/* + check that a status result is OK +*/ +function check_status_ok(status) +{ + if (status.is_ok != true) { + printVars(status); + } + assert(status.is_ok == true); +} + +/* + check that two arrays are equal +*/ +function check_array_equal(a1, a2) +{ + assert(a1.length == a2.length); + for (i=0; i<a1.length; i++) { + assert(a1[i] == a2[i]); + } +} + +/* + check that an array is all zeros +*/ +function check_array_zero(a) +{ + for (i=0; i<a.length; i++) { + assert(a[i] == 0); + } +} + |