Index: openacs-4/packages/acs-events/sql/postgresql/test/utest.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-events/sql/postgresql/test/utest.sql,v diff -u -N -r1.3 -r1.4 --- openacs-4/packages/acs-events/sql/postgresql/test/utest.sql 17 May 2003 09:47:26 -0000 1.3 +++ openacs-4/packages/acs-events/sql/postgresql/test/utest.sql 30 Mar 2013 13:00:30 -0000 1.4 @@ -7,298 +7,304 @@ -- -- $Id$ -create function inline_0 () -returns integer as ' -declare + + +-- +-- procedure inline_0/0 +-- +CREATE OR REPLACE FUNCTION inline_0( + +) RETURNS integer AS $$ +DECLARE v_str varchar; v_datetest timestamp; v_dateref timestamp; -begin +BEGIN PERFORM ut_assert__eq( - ''Test of ut_assert__eq (equality).'', - ''1'', - ''1'', - ''f'', - ''t'' + 'Test of ut_assert__eq (equality).', + '1', + '1', + 'f', + 't' ); PERFORM ut_assert__eq( - ''Test of ut_assert__eq (equality).'', - ''1'', - ''1'' + 'Test of ut_assert__eq (equality).', + '1', + '1' ); PERFORM ut_assert__eq( - ''Test of ut_assert__eq (inequality).'', - ''1'', - ''0'', - ''f'', - ''f'' -- we dont want to raise an exception here + 'Test of ut_assert__eq (inequality).', + '1', + '0', + 'f', + 'f' -- we dont want to raise an exception here ); PERFORM ut_assert__eq( - ''Test of ut_assert__eq (inequality).'', - ''1'', - ''0'' + 'Test of ut_assert__eq (inequality).', + '1', + '0' ); PERFORM ut_assert__eq( - ''Test of ut_assert__b2v (true).'', + 'Test of ut_assert__b2v (true).', ut_assert__b2v(1+1 = 2), - ''true'', - ''f'', - ''t'' + 'true', + 'f', + 't' ); PERFORM ut_assert__eq( - ''Test of ut_assert__b2v (true).'', + 'Test of ut_assert__b2v (true).', ut_assert__b2v(1+1 = 2), - ''true'' + 'true' ); PERFORM ut_assert__eq( - ''Test of ut_assert__b2v (false).'', + 'Test of ut_assert__b2v (false).', ut_assert__b2v(1+1 = 1), - ''false'', - ''f'', - ''t'' + 'false', + 'f', + 't' ); PERFORM ut_assert__eq( - ''Test of ut_assert__b2v (false).'', + 'Test of ut_assert__b2v (false).', ut_assert__b2v(1+1 = 1), - ''false'' + 'false' ); PERFORM ut_assert__eq( - ''Test of ut_assert__eq (boolean,boolean).'', + 'Test of ut_assert__eq (boolean,boolean).', 1+1 = 2, - ''true'', - ''f'', - ''t'' + 'true', + 'f', + 't' ); PERFORM ut_assert__eq( - ''Test of ut_assert__eq (boolean,boolean).'', + 'Test of ut_assert__eq (boolean,boolean).', 1+1 = 2, - ''true'' + 'true' ); PERFORM ut_assert__eq( - ''Test of ut_assert__eq (boolean,boolean).'', + 'Test of ut_assert__eq (boolean,boolean).', 1+1 = 1, - ''false'', - ''f'', - ''t'' + 'false', + 'f', + 't' ); PERFORM ut_assert__eq( - ''Test of ut_assert__eq (boolean,boolean).'', + 'Test of ut_assert__eq (boolean,boolean).', 1+1 = 1, - ''false'' + 'false' ); select now() into v_dateref; v_datetest := v_dateref; PERFORM ut_assert__eq( - ''Test of ut_assert__eq (timestamp,timestamp).'', + 'Test of ut_assert__eq (timestamp,timestamp).', v_datetest, v_dateref, - ''f'', - ''f'' + 'f', + 'f' ); PERFORM ut_assert__eq( - ''Test of ut_assert__eq (timestamp,timestamp).'', + 'Test of ut_assert__eq (timestamp,timestamp).', v_datetest, v_dateref ); - v_datetest := now() + interval ''1 days''; + v_datetest := now() + interval '1 days'; PERFORM ut_assert__eq( - ''Test of ut_assert__eq (timestamp,timestamp).'', + 'Test of ut_assert__eq (timestamp,timestamp).', v_datetest, v_dateref, - ''f'', - ''f'' -- do not raise exception + 'f', + 'f' -- do not raise exception ); PERFORM ut_assert__eq( - ''Test of ut_assert__eq (timestamp,timestamp).'', + 'Test of ut_assert__eq (timestamp,timestamp).', v_datetest, v_dateref ); PERFORM ut_assert__ieqminus( - ''Test of query equality.'', - ''select 1 from dual'', - ''select 1 from dual'', - ''Simple select from dual.'', - ''t'' + 'Test of query equality.', + 'select 1 from dual', + 'select 1 from dual', + 'Simple select from dual.', + 't' ); PERFORM ut_assert__ieqminus( - ''Test of query inequality.'', - ''select 1 from dual'', - ''select 2 from dual'', - ''simple select from dual '', - ''f'' -- do not raise exception since this will fail + 'Test of query inequality.', + 'select 1 from dual', + 'select 2 from dual', + 'simple select from dual ', + 'f' -- do not raise exception since this will fail ); create table ut_temp ( an_integer integer, a_varchar varchar); - insert into ut_temp values (1,''a''); - insert into ut_temp values (2,''b''); + insert into ut_temp values (1,'a'); + insert into ut_temp values (2,'b'); PERFORM ut_assert__ieqminus( - ''Test of query equality.'', - ''select * from ut_temp where an_integer = 1'', - ''select * from ut_temp where a_varchar = '' || '''''''' || ''a'' || '''''''', - ''Simple comparison of two tables.'', - ''t'' + 'Test of query equality.', + 'select * from ut_temp where an_integer = 1', + 'select * from ut_temp where a_varchar = ' || '''' || 'a' || '''', + 'Simple comparison of two tables.', + 't' ); PERFORM ut_assert__ieqminus( - ''Test of query inequality.'', - ''select * from ut_temp where an_integer = 2'', - ''select * from ut_temp'', - ''Simple comparison of two unequal tables.'', - ''f'' + 'Test of query inequality.', + 'select * from ut_temp where an_integer = 2', + 'select * from ut_temp', + 'Simple comparison of two unequal tables.', + 'f' ); create table ut_another as select * from ut_temp; PERFORM ut_assert__eqtable( - ''Test of simple table equality.'', - ''ut_another'', - ''ut_temp'', + 'Test of simple table equality.', + 'ut_another', + 'ut_temp', null, null, - ''t'' + 't' ); PERFORM ut_assert__eqtable( - ''Test of simple table equality.'', - ''ut_another'', - ''ut_temp'' + 'Test of simple table equality.', + 'ut_another', + 'ut_temp' ); PERFORM ut_assert__eqtable( - ''Test of simple table equality.'', - ''ut_another'', - ''ut_temp'', - ''an_integer = 1'', - ''a_varchar = '' || '''''''' || ''a'' || '''''''', - ''t'' + 'Test of simple table equality.', + 'ut_another', + 'ut_temp', + 'an_integer = 1', + 'a_varchar = ' || '''' || 'a' || '''', + 't' ); PERFORM ut_assert__eqtable( - ''Test of simple table inequality.'', - ''ut_another'', - ''ut_temp'', - ''an_integer = 1'', - ''a_varchar = '' || '''''''' || ''b'' || '''''''', - ''f'' + 'Test of simple table inequality.', + 'ut_another', + 'ut_temp', + 'an_integer = 1', + 'a_varchar = ' || '''' || 'b' || '''', + 'f' ); PERFORM ut_assert__eqtabcount( - ''Test of simple table count equality.'', - ''ut_another'', - ''ut_temp'', + 'Test of simple table count equality.', + 'ut_another', + 'ut_temp', null, null, - ''t'' + 't' ); PERFORM ut_assert__eqtabcount( - ''Test of simple table count equality.'', - ''ut_another'', - ''ut_temp'', - ''an_integer = 1'', - ''a_varchar = '' || '''''''' || ''a'' || '''''''', - ''t'' + 'Test of simple table count equality.', + 'ut_another', + 'ut_temp', + 'an_integer = 1', + 'a_varchar = ' || '''' || 'a' || '''', + 't' ); PERFORM ut_assert__eqtabcount( - ''Test of simple table inequality.'', - ''ut_another'', - ''ut_temp'', + 'Test of simple table inequality.', + 'ut_another', + 'ut_temp', null, - ''a_varchar = '' || '''''''' || ''b'' || '''''''', - ''f'' + 'a_varchar = ' || '''' || 'b' || '''', + 'f' ); PERFORM ut_assert__eqquery( - ''Test of query equality.'', - ''select * from ut_temp where an_integer = 1'', - ''select * from ut_temp where a_varchar = '' || '''''''' || ''a'' || '''''''', - ''t'' + 'Test of query equality.', + 'select * from ut_temp where an_integer = 1', + 'select * from ut_temp where a_varchar = ' || '''' || 'a' || '''', + 't' ); PERFORM ut_assert__eqquery( - ''Test of query equality.'', - ''select * from ut_temp where an_integer = 1'', - ''select * from ut_temp where a_varchar = '' || '''''''' || ''a'' || '''''''' + 'Test of query equality.', + 'select * from ut_temp where an_integer = 1', + 'select * from ut_temp where a_varchar = ' || '''' || 'a' || '''' ); PERFORM ut_assert__eqquery( - ''Test of query equality.'', - ''select * from ut_temp where an_integer = 2'', - ''select * from ut_temp'', - ''f'' + 'Test of query equality.', + 'select * from ut_temp where an_integer = 2', + 'select * from ut_temp', + 'f' ); PERFORM ut_assert__eqquery( - ''Test of query equality.'', - ''select * from ut_temp where an_integer = 2'', - ''select * from ut_temp'' + 'Test of query equality.', + 'select * from ut_temp where an_integer = 2', + 'select * from ut_temp' ); delete from ut_another where an_integer=2; PERFORM ut_assert__eqtable( - ''Test of simple table inequality.'', - ''ut_another'', - ''ut_temp'', + 'Test of simple table inequality.', + 'ut_another', + 'ut_temp', null, null, - ''f'' + 'f' ); PERFORM ut_assert__eqtable( - ''Test of simple table inequality.'', - ''ut_another'', - ''ut_temp'' + 'Test of simple table inequality.', + 'ut_another', + 'ut_temp' ); PERFORM ut_assert__isnotnull( - ''Degenerate test of non-null'', - ''1'', - ''f'', - ''t'' + 'Degenerate test of non-null', + '1', + 'f', + 't' ); PERFORM ut_assert__isnotnull( - ''Degenerate test of non-null'', - ''1'' + 'Degenerate test of non-null', + '1' ); PERFORM ut_assert__isnull( - ''Degenerate test of null'', + 'Degenerate test of null', null, - ''f'', - ''t'' + 'f', + 't' ); PERFORM ut_assert__isnull( - ''Degenerate test of null'', + 'Degenerate test of null', null ); @@ -307,14 +313,14 @@ select into v_str a_varchar from ut_another where an_integer = 2; PERFORM ut_assert__isnull( - ''Degenerate test of null'', + 'Degenerate test of null', v_str, - ''f'', - ''t'' + 'f', + 't' ); PERFORM ut_assert__isnull( - ''Degenerate test of null'', + 'Degenerate test of null', v_str ); @@ -323,14 +329,14 @@ select into v_str a_varchar from ut_another where an_integer = 1; PERFORM ut_assert__isnotnull( - ''Degenerate test of null'', + 'Degenerate test of null', v_str, - ''f'', - ''t'' + 'f', + 't' ); PERFORM ut_assert__isnotnull( - ''Degenerate test of null'', + 'Degenerate test of null', v_str ); @@ -339,7 +345,8 @@ return 0; -end;' language 'plpgsql'; +END; +$$ LANGUAGE plpgsql; select (case when inline_0 () = 0