Changeset: f2643c7ae0c8 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=f2643c7ae0c8 Modified Files: sql/test/Tests/function_syntax.test sql/test/Tests/zones.test Branch: default Log Message:
Badly converted tests diffs (truncated from 373 to 300 lines): diff --git a/sql/test/Tests/function_syntax.test b/sql/test/Tests/function_syntax.test --- a/sql/test/Tests/function_syntax.test +++ b/sql/test/Tests/function_syntax.test @@ -1,42 +1,38 @@ -statement error +statement ok create function f1() RETURNS int BEGIN - return 0 - -statement error + return 0; END -statement error +statement ok create function f1(id int) RETURNS int BEGIN - return 0 - -statement error + return 0; END -statement error +statement ok create function f2(id int) RETURNS int BEGIN - return 0 - -statement error + return 0; END -statement error +statement ok create function f3(id int, name varchar(1024)) RETURNS int BEGIN - return 0 - -statement error + return 0; END query T rowsort select name from functions where name = 'f1' or name = 'f2' or name = 'f3' ---- +f1 +f1 +f2 +f3 statement error DROP FUNCTION f1 @@ -44,13 +40,20 @@ DROP FUNCTION f1 query T rowsort select name from functions where name = 'f1' or name = 'f2' or name = 'f3' ---- +f1 +f1 +f2 +f3 -statement error +statement ok DROP FUNCTION f1() query T rowsort select name from functions where name = 'f1' or name = 'f2' or name = 'f3' ---- +f1 +f2 +f3 statement error DROP FUNCTION f2 (int, varchar(1024)) @@ -58,31 +61,35 @@ DROP FUNCTION f2 (int, varchar(1024)) query T rowsort select name from functions where name = 'f1' or name = 'f2' or name = 'f3' ---- +f1 +f2 +f3 -statement error +statement ok DROP FUNCTION f2 (int) query T rowsort select name from functions where name = 'f1' or name = 'f2' or name = 'f3' ---- +f1 +f3 -statement error +statement ok DROP FUNCTION f3 (int, varchar(1024)) query T rowsort select name from functions where name = 'f1' or name = 'f2' or name = 'f3' ---- +f1 -statement error +statement ok create function f1() RETURNS int BEGIN - return f1(3) - -statement error + return f1(3); END -statement error +statement ok DROP ALL FUNCTION f1 statement error diff --git a/sql/test/Tests/zones.test b/sql/test/Tests/zones.test --- a/sql/test/Tests/zones.test +++ b/sql/test/Tests/zones.test @@ -21,12 +21,11 @@ where abs(expected - computed)>0.00001 statement ok create table photoobj ( - objID bigint not null, - ra float not null, - "dec" float not null, - mode tinyint not null, - primary key (objID) - ) + objID bigint not null, + ra float not null, + "dec" float not null, + mode tinyint not null, + primary key (objID)) statement ok insert into photoobj @@ -50,17 +49,16 @@ values( 687726014001184896, 193.75664598 statement ok create table ZoneIndex ( - objID bigint not null, - zone int not null, - ra float not null, - "dec" float not null, - x float not null, - y float not null, - z float not null, - mode tinyint not null, - margin int not null, - primary key (zone, ra, objID) - ) + objID bigint not null, + zone int not null, + ra float not null, + "dec" float not null, + x float not null, + y float not null, + z float not null, + mode tinyint not null, + margin int not null, + primary key (zone, ra, objID)) statement ok create table ZoneHeight( "value" double not null) @@ -70,14 +68,14 @@ insert into ZoneHeight values(cast (0.1 statement ok insert into zoneindex - select objID, - cast(floor("dec"/(select min("value") from ZoneHeight)) as int) as zone, - ra, "dec", - cos(radians("dec"))*cos(radians(ra)) as x, - cos(radians("dec"))*sin(radians(ra)) as y, - sin(radians("dec")) as z, - mode, 0 as margin - from photoobj +select objID, + cast(floor("dec"/(select min("value") from ZoneHeight)) as int) as zone, + ra, "dec", + cos(radians("dec"))*cos(radians(ra)) as x, + cos(radians("dec"))*sin(radians(ra)) as y, + sin(radians("dec")) as z, + mode, 0 as margin +from photoobj statement ok insert into zoneindex @@ -89,123 +87,99 @@ insert into zoneindex select objid,zone,ra+360.0,"dec",x,y,z,mode,1 as margin from zoneindex where ra<180.0 and margin=0 -statement error -create function GetNearbyObjects( - pra double, pdec double, - ptheta double) +statement ok +create function GetNearbyObjects(pra double, pdec double, ptheta double) returns Table (objID bigint, distance double) begin - declare zoneHeight float, alpha1 float, - x1 float, y1 float, z1 float - -statement error - set alpha1 = Alpha(ptheta, pdec) - -statement error - set x1 = cos(radians(pdec))*cos(radians(pra)) - -statement error - set y1 = cos(radians(pdec))*sin(radians(pra)) - -statement error - set z1 = sin(radians(pdec)) - -statement error - return TABLE(select objID, - case when(x1*x +y1*y + z1*z) < 1 - then degrees(acos(x1*x +y1*y + z1*z)) - else 0 end as distance - from zoneindex - where - ra between pra -alpha1 - and pra + alpha1 - and "dec" between pdec - ptheta - and pdec + ptheta - and (x1*x +y1*y + z1*z) - > cos(radians(ptheta)) - ) - -statement error + declare zoneHeight float, alpha1 float,x1 float, y1 float, z1 float; + set alpha1 = Alpha(ptheta, pdec); + set x1 = cos(radians(pdec))*cos(radians(pra)); + set y1 = cos(radians(pdec))*sin(radians(pra)); + set z1 = sin(radians(pdec)); + return TABLE(select objID, + case when(x1*x +y1*y + z1*z) < 1 + then degrees(acos(x1*x +y1*y + z1*z)) + else 0 end as distance + from zoneindex + where + ra between pra -alpha1 + and pra + alpha1 + and "dec" between pdec - ptheta + and pdec + ptheta + and (x1*x +y1*y + z1*z) > cos(radians(ptheta))); end -statement error +query I rowsort select count(S.objID) from GetNearbyObjects(193.75, 1.48, 0.1) as S +---- +3 -statement error -create table zonetest ( - objID bigint, - expected double) +statement ok +create table zonetest (objID bigint, expected double) -statement error -insert into zonetest values( 687726014001184891, 0.00669124492169760) +statement ok +insert into zonetest values( 687726014001184891,0.00669124492169760) -statement error -insert into zonetest values( 687726014001184892, 0.00688278877005443) +statement ok +insert into zonetest values( 687726014001184892,0.00688278877005443) -statement error -insert into zonetest values( 687726014001184894, 0.00700190450261338) +statement ok +insert into zonetest values( 687726014001184894,0.00700190450261338) -statement error -insert into zonetest values( 687726014001184895, 0.13972627471136584) +statement ok +insert into zonetest values( 687726014001184895,0.13972627471136584) -statement error -insert into zonetest values( 687726014001184896, 0.13973831452158963) +statement ok +insert into zonetest values( 687726014001184896,0.13973831452158963) -statement error +query IRR rowsort select S.objID,S.distance, T.expected from GetNearbyObjects(193.75,1.48, 1.0) as S, zonetest as T where S.objID=T.objID and abs(S.distance-T.expected)>0.00001 _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list