Commit 2f2b518d authored by GoshaZotov's avatar GoshaZotov

add unit-test for cot/coth formula

parent 702cfc43
...@@ -611,6 +611,83 @@ $( function () { ...@@ -611,6 +611,83 @@ $( function () {
ok( oParser.parse() ); ok( oParser.parse() );
strictEqual( oParser.calculate().getValue(), Math.atanh(1 / 6) ); strictEqual( oParser.calculate().getValue(), Math.atanh(1 / 6) );
} ); } );
test( "Test: \"COT(30)\"", function () {
oParser = new parserFormula( 'COT(30)', "A1", ws );
ok( oParser.parse() );
strictEqual( oParser.calculate().getValue().toFixed(3) - 0, -0.156 );
} );
test( "Test: \"COT(0)\"", function () {
oParser = new parserFormula( 'COT(0)', "A1", ws );
ok( oParser.parse() );
strictEqual( oParser.calculate().getValue(), "#DIV/0!" );
} );
//> Math.pow(2, 27)
test( "Test: \"COT(1000000000)\"", function () {
oParser = new parserFormula( 'COT(1000000000)', "A1", ws );
ok( oParser.parse() );
strictEqual( oParser.calculate().getValue(), "#NUM!" );
} );
//ABS > Math.pow(2, 27)
test( "Test: \"COT(-1000000000)\"", function () {
oParser = new parserFormula( 'COT(-1000000000)', "A1", ws );
ok( oParser.parse() );
strictEqual( oParser.calculate().getValue(), "#NUM!" );
} );
test( "Test: \"COT(test)\"", function () {
oParser = new parserFormula( 'COT(test)', "A1", ws );
ok( oParser.parse() );
strictEqual( oParser.calculate().getValue(), "#NAME?" );
} );
test( "Test: \"COT('test')\"", function () {
oParser = new parserFormula( 'COT("test")', "A1", ws );
ok( oParser.parse() );
strictEqual( oParser.calculate().getValue(), "#VALUE!" );
} );
test( "Test: \"COTH(2)\"", function () {
oParser = new parserFormula( 'COTH(2)', "A1", ws );
ok( oParser.parse() );
strictEqual( oParser.calculate().getValue().toFixed(3) - 0, 1.037 );
} );
test( "Test: \"COTH(0)\"", function () {
oParser = new parserFormula( 'COTH(0)', "A1", ws );
ok( oParser.parse() );
strictEqual( oParser.calculate().getValue(), "#DIV/0!" );
} );
//> Math.pow(2, 27)
test( "Test: \"COTH(1000000000)\"", function () {
oParser = new parserFormula( 'COTH(1000000000)', "A1", ws );
ok( oParser.parse() );
strictEqual( oParser.calculate().getValue(), 1 );
} );
//ABS > Math.pow(2, 27)
test( "Test: \"COTH(-1000000000)\"", function () {
oParser = new parserFormula( 'COTH(-1000000000)', "A1", ws );
ok( oParser.parse() );
strictEqual( oParser.calculate().getValue(), -1 );
} );
test( "Test: \"COTH(test)\"", function () {
oParser = new parserFormula( 'COTH(test)', "A1", ws );
ok( oParser.parse() );
strictEqual( oParser.calculate().getValue(), "#NAME?" );
} );
test( "Test: \"COTH('test')\"", function () {
oParser = new parserFormula( 'COTH("test")', "A1", ws );
ok( oParser.parse() );
strictEqual( oParser.calculate().getValue(), "#VALUE!" );
} );
test( "Test: \"ARABIC('LVII')\"", function () { test( "Test: \"ARABIC('LVII')\"", function () {
oParser = new parserFormula( 'ARABIC("LVII")', "A1", ws ); oParser = new parserFormula( 'ARABIC("LVII")', "A1", ws );
ok( oParser.parse() ); ok( oParser.parse() );
......
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