| Server IP : 68.183.124.220 / Your IP : 216.73.217.137 Web Server : Apache/2.4.18 (Ubuntu) System : Linux Sandbox-A 4.4.0-210-generic #242-Ubuntu SMP Fri Apr 16 09:57:56 UTC 2021 x86_64 User : gavin ( 1000) PHP Version : 7.0.33-0ubuntu0.16.04.16 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /home/gavin/workspace/happymandarin/node_modules/es6-set/test/ |
Upload File : |
'use strict';
var aFrom = require('es5-ext/array/from')
, toArray = require('es5-ext/array/to-array');
module.exports = function (T, a) {
var arr = ['raz', 'dwa', 'trzy'], set = new T(arr), x = {}, y = {}, i = 0;
a(set instanceof T, true, "Set");
a(set.size, 3, "Size");
a(set.has('raz'), true, "Has: true");
a(set.has(x), false, "Has: false");
a(set.add(x), set, "Add: return");
a(set.has(x), true, "Add");
a(set.size, 4, "Add: Size");
a(set.delete({}), false, "Delete: false");
arr.push(x);
set.forEach(function () {
a.deep(aFrom(arguments), [arr[i], arr[i], set],
"ForEach: Arguments: #" + i);
a(this, y, "ForEach: Context: #" + i);
if (i === 0) {
a(set.delete('raz'), true, "Delete: true");
a(set.has('raz'), false, "Delete");
a(set.size, 3, "Delete: size");
set.add('cztery');
arr.push('cztery');
}
i++;
}, y);
arr.splice(0, 1);
a.deep(toArray(set.entries()), [['dwa', 'dwa'], ['trzy', 'trzy'], [x, x],
['cztery', 'cztery']], "Entries");
a.deep(toArray(set.keys()), ['dwa', 'trzy', x, 'cztery'], "Keys");
a.deep(toArray(set.values()), ['dwa', 'trzy', x, 'cztery'], "Values");
a.deep(toArray(set), ['dwa', 'trzy', x, 'cztery'], "Iterator");
set.clear();
a(set.size, 0, "Clear: size");
a(set.has('trzy'), false, "Clear: has");
a.deep(toArray(set), [], "Clear: Values");
a.h1("Empty initialization");
set = new T();
set.add('foo');
a(set.size, 1);
a(set.has('foo'), true);
};