Commit b42e495a authored by GoshaZotov's avatar GoshaZotov

+ tests for convert formula

parent c8e29874
......@@ -6878,6 +6878,18 @@ $( function () {
ok( oParser.parse() );
strictEqual( oParser.calculate().getValue().toFixed(7) - 0, 0.0154324 );
oParser = new parserFormula( 'CONVERT(1, "lbm", "kg")', "A2", ws );
ok( oParser.parse() );
strictEqual( oParser.calculate().getValue().toFixed(7) - 0, 0.4535923 );
oParser = new parserFormula( 'CONVERT(1, "lbm", "mg")', "A2", ws );
ok( oParser.parse() );
strictEqual( oParser.calculate().getValue().toFixed(0) - 0, 453592 );
oParser = new parserFormula( 'CONVERT(1, "klbm", "mg")', "A2", ws );
ok( oParser.parse() );
strictEqual( oParser.calculate().getValue(), "#N/A" );
} );
test( "Test: \"PRICE\"", function () {
......
......@@ -4984,7 +4984,9 @@
var coeff;
var res;
if(null !== (coeff = getUnitConverterCoeff(from, to))){
if(from === to){
res = num;
} else if(null !== (coeff = getUnitConverterCoeff(from, to))){
if(coeff.length){
res = num;
for(var i = 0; i < coeff.length; i++){
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment