![]() System : Linux absol.cf 5.4.0-198-generic #218-Ubuntu SMP Fri Sep 27 20:18:53 UTC 2024 x86_64 User : www-data ( 33) PHP Version : 7.4.33 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_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, Directory : /proc/thread-self/root/usr/local/lib/node_modules/forever/node_modules/cliff/test/ |
Upload File : |
/* * log-test.js: Tests for cliff. * * (C) 2010, Charlie Robbins & the Contributors * */ var assert = require('assert'), vows = require('vows'), eyes = require('eyes'), cliff = require('../lib/cliff'); vows.describe('cliff').addBatch({ "When using cliff module": { "the columnMajor() method": { "should respond with rows in column major form": function () { var columns, rows = [ ["1a", "2a", "3a", "4a"], ["1b", "2b", "3b", "4b"], ["1c", "2c", "3c", "4c"] ]; columns = cliff.columnMajor(rows); for (var i = 0; i < columns.length; i++) { columns[i].forEach(function (val) { assert.isTrue(val.indexOf(i + 1) !== -1); }); } } }, "the arrayLengths() method": { "with a set of strings": { "should respond with a list of the longest elements": function () { var lengths, rows = [ ["1a", "2a", "3a", "4a"], ["1b", "2bb", "3b", "4b"], ["1c", "2c", "3ccc", "4c"], ["1d", "2d", "3dd", "4dddd"] ]; lengths = cliff.arrayLengths(rows); assert.equal(lengths[0], 2); assert.equal(lengths[1], 3); assert.equal(lengths[2], 4); assert.equal(lengths[3], 5); } }, "with a set of numbers and strings": { "should respond with a list of the longest elements": function () { var lengths, rows = [ [11, "2a", "3a", "4a"], ["1b", 222, "3b", "4b"], ["1c", "2c", 3333, "4c"], ["1d", "2d", "3dd", 44444] ]; lengths = cliff.arrayLengths(rows); assert.equal(lengths[0], 2); assert.equal(lengths[1], 3); assert.equal(lengths[2], 4); assert.equal(lengths[3], 5); } } }, "the stringifyRows() method": { "should calculate padding correctly for numbers": function() { var rows = [ ['a', 'b'], [12345, 1] ]; assert.equal( cliff.stringifyRows(rows), 'a b \n12345 1 ' ); } } } }).export(module);