Comment : Charset=windows-1252
Comment : test cases for management of constrained types

Comment : define a constrained type based on type foo - should fail because foo doesn't exist
Request : assert constrainedtype,constrainedtype(tuple(typename(strictlypositivefoo)sp_expression( gt\(parameter\(v\(foo\)\),foo\(x\(0\)y\(0\)\)\) )basetype(foo)))
Reply   : 201806116:70:Constrained type STRICTLYPOSITIVEFOO is defined as a specialization of an unknown type FOO.

Comment : define a constrained type
Request : assert javabackedtype,javabackedtype(tuple(typename(foo)))
Reply   : 

Comment : define a constrained type based on type foo - should now succeed
Request : assert constrainedtype,constrainedtype(tuple(typename(strictlypositivefoo)sp_expression( gt\(parameter\(v\(foo\)\),foo\(x\(0\)y\(0\)\)\) )basetype(foo)))
Reply   : 

Comment : type should be available and do its job properly
Request : inquire extend(table_dee,foov(strictlypositivefoo(x(-1)y(1))))
Reply   : 858993459:-1:java.lang.IllegalArgumentException:X(-1.0)Y(1.0) does not satisfy the type constraint expression gt(parameter(v(foo)),foo(x(0)y(0)))
Request : inquire extend(table_dee,foov(strictlypositivefoo(x(0)y(1))))
Reply   : RELATION(HEADING(FOOV(STRICTLYPOSITIVEFOO))BODY(TUPLE(FOOV(X(0.0)Y(1.0)))))
Request : inquire extend(table_dee,foov(strictlypositivefoo(x(0.00000000001)y(1))))
Reply   : RELATION(HEADING(FOOV(STRICTLYPOSITIVEFOO))BODY(TUPLE(FOOV(X(1.0E-11)Y(1.0)))))
Request : inquire extend(table_dee,foov(strictlypositivefoo(x(0)y(0))))
Reply   : 858993459:-1:java.lang.IllegalArgumentException:X(0.0)Y(0.0) does not satisfy the type constraint expression gt(parameter(v(foo)),foo(x(0)y(0)))
Request : inquire extend(table_dee,foov_y(the_y(strictlypositivefoo(x(0.00000000001)y(2)))))
Reply   : RELATION(HEADING(FOOV_Y(FLOAT))BODY(TUPLE(FOOV_Y(2.0))))

Comment : try to delete type foo, should fail on the existance of the constrained type
Request : unassert javabackedtype,javabackedtype(tuple(typename(foo)))
Reply   : 201806116:70:Constrained type STRICTLYPOSITIVEFOO is defined as a specialization of an unknown type FOO.

Comment : delete the test type
Request : unassert constrainedtype,constrainedtype(tuple(typename(strictlypositivefoo)sp_expression( gt\(parameter\(v\(foo\)\),foo\(x\(0\)y\(0\)\)\) )basetype(foo)))
Reply   : 

Comment : try to delete type foo, should now pass
Request : unassert javabackedtype,javabackedtype(tuple(typename(foo)))
Reply   : 

Comment : types should have disappeared from the pools
Request : inquire extend(table_dee,foov(foo(x(1.570796)y(1))))
Reply   : 1497858657:252:Comma missing after operand X
Request : inquire extend(table_dee,foov(strictlypositivefoo(x(-1)y(1))))
Reply   : 1497858657:252:Comma missing after operand X

Comment : do a few things wrong
Comment : mismatch between basetype and constraint expression
Request : assert constrainedtype,constrainedtype(tuple(typename(strictlypositiveint)sp_expression( gt\(parameter\(v\(int\)\),int\(0\)\) )basetype(long)))
Reply   : 201806116:170:The expression defining constrained type STRICTLYPOSITIVEINT, is not a boolean expression, or it involves database relvar references, or it does not exclusively involve a parameter named V of the declared base type.
Comment : wrong parameter in expression
Request : assert constrainedtype,constrainedtype(tuple(typename(strictlypositiveint)sp_expression( gt\(parameter\(w\(int\)\),int\(0\)\) )basetype(int)))
Reply   : 201806116:170:The expression defining constrained type STRICTLYPOSITIVEINT, is not a boolean expression, or it involves database relvar references, or it does not exclusively involve a parameter named V of the declared base type.
Comment : wrong parameter in expression alongside good parameter
Request : assert constrainedtype,constrainedtype(tuple(typename(strictlypositiveint)sp_expression( gt\(parameter\(w\(int\)\),parameter\(v\(int\)\)\) )basetype(int)))
Reply   : 201806116:170:The expression defining constrained type STRICTLYPOSITIVEINT, is not a boolean expression, or it involves database relvar references, or it does not exclusively involve a parameter named V of the declared base type.
Comment : no parameter in expression 
Request : assert constrainedtype,constrainedtype(tuple(typename(strictlypositiveint)sp_expression( boolean\(true\) )basetype(int)))
Reply   : 201806116:170:The expression defining constrained type STRICTLYPOSITIVEINT, is not a boolean expression, or it involves database relvar references, or it does not exclusively involve a parameter named V of the declared base type.
Comment : expression with compile error
Request : assert constrainedtype,constrainedtype(tuple(typename(strictlypositiveint)sp_expression( boolean\(tru\) )basetype(int)))
Reply   : 858993459:-1:java.lang.IllegalArgumentException:tru is not a valid representation for a BOOLEAN value.  Only 'true' and 'false' are.
Comment : expression with compile error
Request : assert constrainedtype,constrainedtype(tuple(typename(strictlypositiveint)sp_expression( gt\(parameter\(w\(int\)\),long\(0\)\) )basetype(int)))
Reply   : 1497858657:253:Operator implementation for operator GT(INT;LONG) could not be loaded. The cause of this problem was a be.erwinsmout.NotFoundException.
Comment : expression with a relvar reference
Request : assert constrainedtype,constrainedtype(tuple(typename(strictlypositiveint)sp_expression( eq\(table_dum,project\(join\(dbmsfile,relation\( heading\(pagesize\(int\)\) body\(tuple\(pagesize\( parameter\(v\(int\)\)\)\) \)\)\),\(\)\)\) )basetype(int)))
Reply   : 201806116:170:The expression defining constrained type STRICTLYPOSITIVEINT, is not a boolean expression, or it involves database relvar references, or it does not exclusively involve a parameter named V of the declared base type.
Comment : not a boolean expression
Request : assert constrainedtype,constrainedtype(tuple(typename(strictlypositiveint)sp_expression( parameter\(v\(int\)\) )basetype(int)))
Reply   : 201806116:170:The expression defining constrained type STRICTLYPOSITIVEINT, is not a boolean expression, or it involves database relvar references, or it does not exclusively involve a parameter named V of the declared base type.
END
