more tests

This commit is contained in:
bharatnc 2022-01-19 22:05:58 -08:00
parent 6e8439e764
commit ab1f8b496b
2 changed files with 72 additions and 13 deletions

View File

@ -7,3 +7,36 @@
180
180.5
360
-6.283185307179586
-3.152064629101759
-3.141592653589793
-0.017453292519943295
0
0.017453292519943295
3.141592653589793
3.1503192998497647
6.283185307179586
-10
-6.283185307179586
-3.152064629101759
-3.141592653589793
-0.017453292519943295
0
0.017453292519943295
1
3.141592653589793
3.1503192998497647
6.283185307179586
10
-572.9577951308232
-360
-180.6
-180
-1
0
1
57.29577951308232
180
180.5
360
572.9577951308232

View File

@ -1,20 +1,46 @@
DROP TABLE IF EXISTS test_degs_rads;
-- test conversion from degrees to radians
DROP TABLE IF EXISTS test_degs_to_rads;
CREATE TABLE test_degs_to_rads (degrees Float64) ENGINE = Memory;
CREATE TABLE test_degs_rads (degrees Float64) ENGINE = Memory;
INSERT INTO test_degs_to_rads VALUES (-1);
INSERT INTO test_degs_to_rads VALUES (-180);
INSERT INTO test_degs_to_rads VALUES (-180.6);
INSERT INTO test_degs_to_rads VALUES (-360);
INSERT INTO test_degs_to_rads VALUES (0);
INSERT INTO test_degs_to_rads VALUES (1);
INSERT INTO test_degs_to_rads VALUES (180);
INSERT INTO test_degs_to_rads VALUES (180.5);
INSERT INTO test_degs_to_rads VALUES (360);
-- test that converting degrees to radians and back preserves the original value
select DEGREES(RADIANS(degrees)) from test_degs_to_rads order by degrees;
-- test that radians func returns correct value for both int and floats
select RADIANS(degrees) from test_degs_to_rads order by degrees;
INSERT INTO test_degs_rads VALUES (-1);
INSERT INTO test_degs_rads VALUES (-180);
INSERT INTO test_degs_rads VALUES (-180.6);
INSERT INTO test_degs_rads VALUES (-360);
INSERT INTO test_degs_rads VALUES (0);
INSERT INTO test_degs_rads VALUES (1);
INSERT INTO test_degs_rads VALUES (180);
INSERT INTO test_degs_rads VALUES (180.5);
INSERT INTO test_degs_rads VALUES (360);
DROP TABLE test_degs_to_rads;
-- test conversion from radians to degrees
DROP TABLE IF EXISTS test_rads_to_degs;
select DEGREES(RADIANS(degrees)) from test_degs_rads order by degrees;
CREATE TABLE test_rads_to_degs (radians Float64) ENGINE = Memory;
DROP TABLE test_degs_rads;
INSERT INTO test_rads_to_degs VALUES (-6.283185307179586);
INSERT INTO test_rads_to_degs VALUES (-3.152064629101759);
INSERT INTO test_rads_to_degs VALUES (-3.141592653589793);
INSERT INTO test_rads_to_degs VALUES (-0.017453292519943295);
INSERT INTO test_rads_to_degs VALUES(0);
INSERT INTO test_rads_to_degs VALUES(1);
INSERT INTO test_rads_to_degs VALUES(10);
INSERT INTO test_rads_to_degs VALUES(-10);
INSERT INTO test_rads_to_degs VALUES (0.017453292519943295);
INSERT INTO test_rads_to_degs VALUES (3.141592653589793);
INSERT INTO test_rads_to_degs VALUES (3.1503192998497647);
INSERT INTO test_rads_to_degs VALUES (6.283185307179586);
-- test that converting radians to degrees and back preserves the original value
select RADIANS(DEGREES(radians)) from test_rads_to_degs order by radians;
-- test that degrees func returns correct value for both int and floats
select DEGREES(radians) from test_rads_to_degs order by radians;
DROP TABLE test_rads_to_degs;