1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- /**
- * Created by Tony on 2017/4/7.
- */
- var test = require('tape');
- var strUtil = require('../../public/stringUtil');
- //test('some string test cases', function (t) {
- // var reg = /^\s*$/;
- // var foo = " ";
- // t.equal(reg.test(foo), true);
- // foo = null;
- // t.equal(reg.test(foo), true);
- // foo = undefined;
- // t.equal(reg.test(foo), true);
- // foo = "";
- // t.equal(reg.test(foo), true);
- // foo = 0;
- // t.equal(reg.test(foo), true);
- // t.end();
- //});
- //
- //test('check if string type', function(t){
- // var foo = "";
- // t.equal(typeof foo, 'string');
- // foo = " ";
- // t.equal(typeof foo, 'string');
- // foo = 0;
- // t.equal(typeof foo, 'number');
- // foo = true;
- // t.equal(typeof foo, 'boolean');
- // foo = {};
- // t.equal(typeof foo, 'object');
- // foo = function(){};
- // t.equal(typeof foo, 'function');
- // foo = [];
- // t.equal(Array.isArray(foo), true);
- // t.end();
- //})
- test('test number to Chinese', function(t){
- //t.equal(strUtil.convertNumToChinese(1, true), '壹');
- //t.equal(strUtil.convertNumToChinese(1, false), '一');
- t.equal(strUtil.convertNumToChinese(11, false), '一十一');
- t.equal(strUtil.convertNumToChinese(12, false), '一十二');
- t.equal(strUtil.convertNumToChinese(21, false), '二十一');
- //console.log(strUtil.convertNumToChinese(102, false));
- t.equal(strUtil.convertNumToChinese(102, false), '一百零二');
- t.end();
- })
|