| 123456789101112131415161718192021222324252627282930313233343536373839404142 | /** * Created by Tony on 2017/3/16. */var test = require('tape');test('basic arithmetic', function (t) {    t.equal(2 + 3, 5);    t.equal(7 * 8 + 9, 65);    t.equal(/^-?\d+$/.test("10"), true);    //t.equal(isNaN(10.1), true);    t.equal(Math.round(10.4999), 10);    t.end();});test('', function(t){    var dt = new Date();    p_fillZero = function(val){        var rst = val;        if (val < 10) {            rst = '0' + val;        }        return rst;    };    console.log(dt.getFullYear() + '-' + p_fillZero(dt.getMonth()) + '-' + p_fillZero(dt.getDate()) + 'T' +        p_fillZero(dt.getHours()) + ':' + p_fillZero(dt.getMinutes()) + ':' + p_fillZero(dt.getSeconds()) + 'Z');    t.pass('just pass');    t.end();})test('default sorting...', function(t){    var arrSimple=new Array(1,8,7,6,10,11);    arrSimple.sort(function(i1, i2){        rst = 0;        if (i1 > i2) {rst = 1} else        if (i1 < i2) rst = -1;        return rst;    });    console.log(arrSimple);    t.pass('just pass');    t.end();})
 |