357 lines
12 KiB
Plaintext
357 lines
12 KiB
Plaintext
|
|
# Unit tests for operators bbox, inst, val, deftime and present.
|
||
|
|
|
||
|
|
###############################################################################
|
||
|
|
|
||
|
|
create database mratest;
|
||
|
|
open database mratest;
|
||
|
|
|
||
|
|
###############################################################################
|
||
|
|
|
||
|
|
let mr1 =
|
||
|
|
[ const movingregion value (((0.0 10.0 TRUE TRUE)
|
||
|
|
((((1.0 3.5 1.5 1.5)
|
||
|
|
(2.0 5.5 3.0 4.5)
|
||
|
|
(3.0 6.5 3.5 5.0)
|
||
|
|
(4.0 6.5 5.5 5.0)
|
||
|
|
(4.0 5.5 5.5 4.5)
|
||
|
|
(5.0 4.5 7.5 2.5)
|
||
|
|
(5.0 2.5 7.5 1.0)
|
||
|
|
(4.0 1.5 7.0 0.5)
|
||
|
|
(3.0 1.5 2.5 0.5))
|
||
|
|
((2.0 3.0 3.0 2.0)
|
||
|
|
(2.0 4.0 3.0 3.0)
|
||
|
|
(3.0 4.0 4.0 3.0)
|
||
|
|
(3.0 3.0 4.0 2.0)))))) ];
|
||
|
|
|
||
|
|
###############################################################################
|
||
|
|
|
||
|
|
let mr1pa =
|
||
|
|
[ const mpoint value (((0.0 10.0 TRUE TRUE)
|
||
|
|
(1.0 1.0 7.0 7.0))) ];
|
||
|
|
|
||
|
|
#testcase "a1 - intersection"
|
||
|
|
#tolerance_real 0.00000001
|
||
|
|
#yields (mpoint ((("2000-01-04-20:26:40" "2000-01-05-20:34:17.143" TRUE TRUE) (2.111111111111111 2.111111111111111 2.714285714285714 2.714285714285714)) (("2000-01-07" "2000-01-09-16:00" TRUE TRUE) (3.4 3.4 5.0 5.0))))
|
||
|
|
query intersection(mr1pa, mr1);
|
||
|
|
|
||
|
|
#testcase "a2 - inside"
|
||
|
|
#tolerance_real 0.00000001
|
||
|
|
#yields (mbool ((("2000-01-03" "2000-01-04-20:26:40" TRUE FALSE) FALSE) (("2000-01-04-20:26:40" "2000-01-05-20:34:17.143" TRUE TRUE) TRUE) (("2000-01-05-20:34:17.143" "2000-01-07" FALSE FALSE) FALSE) (("2000-01-07" "2000-01-09-16:00" TRUE TRUE) TRUE) (("2000-01-09-16:00" "2000-01-13" FALSE TRUE) FALSE)))
|
||
|
|
query mr1pa inside mr1;
|
||
|
|
|
||
|
|
###############################################################################
|
||
|
|
|
||
|
|
let mr1pb =
|
||
|
|
[ const mpoint value (((0.0 10.0 TRUE TRUE)
|
||
|
|
(3.0 1.75 4.0 1.75))) ];
|
||
|
|
|
||
|
|
#testcase "b1 - intersection"
|
||
|
|
#tolerance_real 0.00000001
|
||
|
|
#yields (mpoint ((("2000-01-03" "2000-01-13" TRUE TRUE) (3.0 1.75 4.0 1.75))))
|
||
|
|
query intersection(mr1pb, mr1);
|
||
|
|
|
||
|
|
#testcase "b2 - inside"
|
||
|
|
#tolerance_real 0.00000001
|
||
|
|
#yields (mbool ((("2000-01-03" "2000-01-13" TRUE TRUE) TRUE)))
|
||
|
|
query mr1pb inside mr1;
|
||
|
|
|
||
|
|
###############################################################################
|
||
|
|
|
||
|
|
let mr1pc =
|
||
|
|
[ const mpoint value (((0.0 10.0 TRUE TRUE)
|
||
|
|
(3.0 0.25 4.0 0.25))) ];
|
||
|
|
|
||
|
|
# It would be preferable if intersection returns an undefined mpoint value
|
||
|
|
# for test case c1 but undef mpoint values are not supported by the current
|
||
|
|
# version of the TemporalAlgebra (as of 26-Mar-2006).
|
||
|
|
|
||
|
|
#testcase "c1 - intersection"
|
||
|
|
#tolerance_real 0.00000001
|
||
|
|
#yields (mpoint ())
|
||
|
|
query intersection(mr1pc, mr1);
|
||
|
|
|
||
|
|
#testcase "c2 - inside"
|
||
|
|
#tolerance_real 0.00000001
|
||
|
|
#yields (mbool ((("2000-01-03" "2000-01-13" TRUE TRUE) FALSE)))
|
||
|
|
query mr1pc inside mr1;
|
||
|
|
|
||
|
|
###############################################################################
|
||
|
|
|
||
|
|
let mr1pd =
|
||
|
|
[ const mpoint value (((0.0 10.0 TRUE TRUE)
|
||
|
|
(3.0 4.25 3.5 4.25))) ];
|
||
|
|
|
||
|
|
#testcase "d1 - intersection"
|
||
|
|
#tolerance_real 0.00000001
|
||
|
|
#yields (mpoint ((("2000-01-03" "2000-01-13" TRUE TRUE) (3.0 4.25 3.5 4.25))))
|
||
|
|
query intersection(mr1pd, mr1);
|
||
|
|
|
||
|
|
#testcase "d2 - inside"
|
||
|
|
#tolerance_real 0.00000001
|
||
|
|
#yields (mbool ((("2000-01-03" "2000-01-13" TRUE TRUE) TRUE)))
|
||
|
|
query mr1pd inside mr1;
|
||
|
|
|
||
|
|
###############################################################################
|
||
|
|
|
||
|
|
let mr1pe =
|
||
|
|
[ const mpoint value (((0.0 10.0 TRUE TRUE)
|
||
|
|
(4.5 4.0 5.0 4.0))) ];
|
||
|
|
|
||
|
|
#testcase "e1 - intersection"
|
||
|
|
#tolerance_real 0.00000001
|
||
|
|
#yields (mpoint ((("2000-01-03" "2000-01-13" TRUE TRUE) (4.5 4.0 5.0 4.0))))
|
||
|
|
query intersection(mr1pe, mr1);
|
||
|
|
|
||
|
|
#testcase "e2 - inside"
|
||
|
|
#tolerance_real 0.00000001
|
||
|
|
#yields (mbool ((("2000-01-03" "2000-01-13" TRUE TRUE) TRUE)))
|
||
|
|
query mr1pe inside mr1;
|
||
|
|
|
||
|
|
###############################################################################
|
||
|
|
|
||
|
|
let mr1pf =
|
||
|
|
[ const mpoint value (((0.0 10.0 TRUE TRUE)
|
||
|
|
(5.0 0.25 7.5 0.25))) ];
|
||
|
|
|
||
|
|
#testcase "f1 - intersection"
|
||
|
|
#tolerance_real 0.00000001
|
||
|
|
#yields (mpoint ())
|
||
|
|
query intersection(mr1pf, mr1);
|
||
|
|
|
||
|
|
#testcase "f2 - inside"
|
||
|
|
#tolerance_real 0.00000001
|
||
|
|
#yields (mbool ((("2000-01-03" "2000-01-13" TRUE TRUE) FALSE)))
|
||
|
|
query mr1pf inside mr1;
|
||
|
|
|
||
|
|
###############################################################################
|
||
|
|
|
||
|
|
let mr1pg =
|
||
|
|
[ const mpoint value (((-10.0 10.0 TRUE TRUE)
|
||
|
|
(1.0 3.0 1.0 4.0))) ];
|
||
|
|
|
||
|
|
#testcase "g1 - intersection"
|
||
|
|
#tolerance_real 0.00000001
|
||
|
|
#yields (mpoint ((("2000-01-03" "2000-01-03" TRUE TRUE) (1.0 3.5 1.0 3.5))))
|
||
|
|
query intersection(mr1pg, mr1);
|
||
|
|
|
||
|
|
#testcase "g2 - inside"
|
||
|
|
#tolerance_real 0.00000001
|
||
|
|
#yields (mbool ((("1999-12-24" "2000-01-03" TRUE FALSE) FALSE) (("2000-01-03" "2000-01-03" TRUE TRUE) TRUE) (("2000-01-03" "2000-01-13" FALSE TRUE) FALSE)))
|
||
|
|
query mr1pg inside mr1;
|
||
|
|
|
||
|
|
###############################################################################
|
||
|
|
|
||
|
|
let mr1ph =
|
||
|
|
[ const mpoint value (((-10.0 10.0 TRUE TRUE)
|
||
|
|
(1.0 5.5 3.0 5.5))) ];
|
||
|
|
|
||
|
|
#testcase "h1 - intersection"
|
||
|
|
#tolerance_real 0.00000001
|
||
|
|
#yields (mpoint ((("2000-01-03" "2000-01-03" TRUE TRUE) (2.0 5.5 2.0 5.5))))
|
||
|
|
query intersection(mr1ph, mr1);
|
||
|
|
|
||
|
|
#testcase "h2 - inside"
|
||
|
|
#tolerance_real 0.00000001
|
||
|
|
#yields (mbool ((("1999-12-24" "2000-01-03" TRUE FALSE) FALSE) (("2000-01-03" "2000-01-03" TRUE TRUE) TRUE) (("2000-01-03" "2000-01-13" FALSE TRUE) FALSE)))
|
||
|
|
query mr1ph inside mr1;
|
||
|
|
|
||
|
|
###############################################################################
|
||
|
|
|
||
|
|
let mr1pi =
|
||
|
|
[ const mpoint value (((0.0 10.0 TRUE TRUE)
|
||
|
|
(2.0 5.5 1.0 6.5))) ];
|
||
|
|
|
||
|
|
#testcase "i1 - intersection"
|
||
|
|
#tolerance_real 0.00000001
|
||
|
|
#yields (mpoint ((("2000-01-03" "2000-01-03" TRUE TRUE) (2.0 5.5 2.0 5.5))))
|
||
|
|
query intersection(mr1pi, mr1);
|
||
|
|
|
||
|
|
#testcase "i2 - inside"
|
||
|
|
#tolerance_real 0.00000001
|
||
|
|
#yields (mbool ((("2000-01-03" "2000-01-03" TRUE TRUE) TRUE) (("2000-01-03" "2000-01-13" FALSE TRUE) FALSE)))
|
||
|
|
query mr1pi inside mr1;
|
||
|
|
|
||
|
|
###############################################################################
|
||
|
|
|
||
|
|
let mr1pj =
|
||
|
|
[ const mpoint value (((0.0 20.0 TRUE TRUE)
|
||
|
|
(4.0 4.5 2.0 4.5))) ];
|
||
|
|
|
||
|
|
#testcase "j1 - intersection"
|
||
|
|
#tolerance_real 0.00000001
|
||
|
|
#yields (mpoint ((("2000-01-03" "2000-01-13" TRUE TRUE) (4.0 4.5 3.0 4.5))))
|
||
|
|
query intersection(mr1pj, mr1);
|
||
|
|
|
||
|
|
#testcase "j2 - inside"
|
||
|
|
#tolerance_real 0.00000001
|
||
|
|
#yields (mbool ((("2000-01-03" "2000-01-13" TRUE TRUE) TRUE) (("2000-01-13" "2000-01-23" FALSE TRUE) FALSE)))
|
||
|
|
query mr1pj inside mr1;
|
||
|
|
|
||
|
|
###############################################################################
|
||
|
|
|
||
|
|
let mr1pk =
|
||
|
|
[ const mpoint value (((0.0 10.0 TRUE TRUE)
|
||
|
|
(1.0 3.5 1.0 4.5))) ];
|
||
|
|
|
||
|
|
#testcase "k1 - intersection"
|
||
|
|
#tolerance_real 0.00000001
|
||
|
|
#yields (mpoint ((("2000-01-03" "2000-01-03" TRUE TRUE) (1.0 3.5 1.0 3.5))))
|
||
|
|
query intersection(mr1pk, mr1);
|
||
|
|
|
||
|
|
#testcase "k2 - inside"
|
||
|
|
#tolerance_real 0.00000001
|
||
|
|
#yields (mbool ((("2000-01-03" "2000-01-03" TRUE TRUE) TRUE) (("2000-01-03" "2000-01-13" FALSE TRUE) FALSE)))
|
||
|
|
query mr1pk inside mr1;
|
||
|
|
|
||
|
|
###############################################################################
|
||
|
|
|
||
|
|
let mr1pl1 =
|
||
|
|
[ const mpoint value (((0.0 10.0 TRUE TRUE)
|
||
|
|
(2.0 5.5 3.5 5.0))) ];
|
||
|
|
|
||
|
|
#testcase "l11 - intersection"
|
||
|
|
#tolerance_real 0.00000001
|
||
|
|
#yields (mpoint ((("2000-01-03" "2000-01-13" TRUE TRUE) (2.0 5.5 3.5 5.0))))
|
||
|
|
query intersection(mr1pl1, mr1);
|
||
|
|
|
||
|
|
#testcase "l12 - inside"
|
||
|
|
#tolerance_real 0.00000001
|
||
|
|
#yields (mbool ((("2000-01-03" "2000-01-13" TRUE TRUE) TRUE)))
|
||
|
|
query mr1pl1 inside mr1;
|
||
|
|
|
||
|
|
###############################################################################
|
||
|
|
|
||
|
|
let mr1pl2 =
|
||
|
|
[ const mpoint value (((0.0 10.0 TRUE TRUE)
|
||
|
|
(2.25 5.75 3.375 4.875))) ];
|
||
|
|
|
||
|
|
#testcase "l21 - intersection"
|
||
|
|
#tolerance_real 0.00000001
|
||
|
|
#yields (mpoint ((("2000-01-03" "2000-01-13" TRUE TRUE) (2.25 5.75 3.375 4.875))))
|
||
|
|
query intersection(mr1pl2, mr1);
|
||
|
|
|
||
|
|
#testcase "l22 - inside"
|
||
|
|
#tolerance_real 0.00000001
|
||
|
|
#yields (mbool ((("2000-01-03" "2000-01-13" TRUE TRUE) TRUE)))
|
||
|
|
query mr1pl2 inside mr1;
|
||
|
|
|
||
|
|
###############################################################################
|
||
|
|
|
||
|
|
let mr1pl3 =
|
||
|
|
[ const mpoint value (((0.0 10.0 TRUE TRUE)
|
||
|
|
(2.25 5.75 3.75 5.25))) ];
|
||
|
|
|
||
|
|
#testcase "l31 - intersection"
|
||
|
|
#tolerance_real 0.00000001
|
||
|
|
#yields (mpoint ((("2000-01-03" "2000-01-10-12:00" TRUE TRUE) (2.25 5.75 3.375 5.375))))
|
||
|
|
query intersection(mr1pl3, mr1);
|
||
|
|
|
||
|
|
#testcase "l32 - inside"
|
||
|
|
#tolerance_real 0.00000001
|
||
|
|
#yields (mbool ((("2000-01-03" "2000-01-10-12:00" TRUE TRUE) TRUE) (("2000-01-10-12:00" "2000-01-13" FALSE TRUE) FALSE)))
|
||
|
|
query mr1pl3 inside mr1;
|
||
|
|
|
||
|
|
###############################################################################
|
||
|
|
|
||
|
|
let mr1pl4 =
|
||
|
|
[ const mpoint value (((0.0 10.0 TRUE TRUE)
|
||
|
|
(1.75 5.25 3.25 4.75))) ];
|
||
|
|
|
||
|
|
#testcase "l41 - intersection"
|
||
|
|
#tolerance_real 0.00000001
|
||
|
|
#yields (mpoint ((("2000-01-07-24:00" "2000-01-13" TRUE TRUE) (2.5 5.0 3.25 4.75))))
|
||
|
|
query intersection(mr1pl4, mr1);
|
||
|
|
|
||
|
|
#testcase "l42 - inside"
|
||
|
|
#tolerance_real 0.00000001
|
||
|
|
#yields (mbool ((("2000-01-03" "2000-01-08" TRUE FALSE) FALSE) (("2000-01-08" "2000-01-13" TRUE TRUE) TRUE)))
|
||
|
|
query mr1pl4 inside mr1;
|
||
|
|
|
||
|
|
###############################################################################
|
||
|
|
|
||
|
|
let mr1pl5 =
|
||
|
|
[ const mpoint value (((0.0 10.0 TRUE TRUE)
|
||
|
|
(1.75 5.25 3.75 5.25))) ];
|
||
|
|
|
||
|
|
#testcase "l41 - intersection"
|
||
|
|
#tolerance_real 0.00000001
|
||
|
|
#yields (mpoint ((("2000-01-05-12:00" "2000-01-11-08:00" TRUE TRUE) (2.25 5.25 3.416666666666667 5.25))))
|
||
|
|
query intersection(mr1pl5, mr1);
|
||
|
|
|
||
|
|
#testcase "l42 - inside"
|
||
|
|
#tolerance_real 0.00000001
|
||
|
|
#yields (mbool ((("2000-01-03" "2000-01-05-12:00" TRUE FALSE) FALSE) (("2000-01-05-12:00" "2000-01-11-08:00" TRUE TRUE) TRUE) (("2000-01-11-08:00" "2000-01-13" FALSE TRUE) FALSE)))
|
||
|
|
query mr1pl5 inside mr1;
|
||
|
|
|
||
|
|
###############################################################################
|
||
|
|
|
||
|
|
let mr1pm1 =
|
||
|
|
[ const mpoint value (((-10.0 10.0 TRUE TRUE)
|
||
|
|
(1.0 4.25 2.5 4.25))) ];
|
||
|
|
|
||
|
|
#testcase "m11 - intersection"
|
||
|
|
#tolerance_real 0.00000001
|
||
|
|
#yields (mpoint ((("2000-01-03" "2000-01-08" TRUE TRUE) (1.75 4.25 2.125 4.25))))
|
||
|
|
query intersection(mr1pm1, mr1);
|
||
|
|
|
||
|
|
#testcase "m12 - inside"
|
||
|
|
#tolerance_real 0.00000001
|
||
|
|
#yields (mbool ((("1999-12-24" "2000-01-03" TRUE FALSE) FALSE) (("2000-01-03" "2000-01-08" TRUE TRUE) TRUE) (("2000-01-08" "2000-01-13" FALSE TRUE) FALSE)))
|
||
|
|
query mr1pm1 inside mr1;
|
||
|
|
|
||
|
|
###############################################################################
|
||
|
|
|
||
|
|
let mr1pm2 =
|
||
|
|
[ const mpoint value (((0.0 10.0 TRUE TRUE)
|
||
|
|
(2.5 4.25 1.75 4.25))) ];
|
||
|
|
|
||
|
|
#testcase "m21 - intersection"
|
||
|
|
#tolerance_real 0.00000001
|
||
|
|
#yields (mpoint ((("2000-01-03" "2000-01-08" TRUE TRUE) (2.5 4.25 2.125 4.25))))
|
||
|
|
query intersection(mr1pm2, mr1);
|
||
|
|
|
||
|
|
#testcase "m22 - inside"
|
||
|
|
#tolerance_real 0.00000001
|
||
|
|
#yields (mbool ((("2000-01-03" "2000-01-08" TRUE TRUE) TRUE) (("2000-01-08" "2000-01-13" FALSE TRUE) FALSE)))
|
||
|
|
query mr1pm2 inside mr1;
|
||
|
|
|
||
|
|
###############################################################################
|
||
|
|
|
||
|
|
let r1 = [ const region value ((((200.0 100.0)
|
||
|
|
(100.0 100.0)
|
||
|
|
(100.0 200.0)
|
||
|
|
(200.0 200.0))
|
||
|
|
((175.0 125.0)
|
||
|
|
(125.0 125.0)
|
||
|
|
(125.0 175.0)
|
||
|
|
(175.0 175.0)))) ];
|
||
|
|
|
||
|
|
let r1p1 =
|
||
|
|
[ const mpoint value (((0.0 10.0 TRUE TRUE)
|
||
|
|
(50.0 150.0 250.0 150.0))) ];
|
||
|
|
|
||
|
|
#testcase "n - at"
|
||
|
|
#yields (mpoint ((("2000-01-05-12:00" "2000-01-06-18:00" TRUE TRUE) (100.0 150.0 125.0 150.0)) (("2000-01-09-06:00" "2000-01-10-12:00" TRUE TRUE) (175.0 150.0 200.0 150.0))))
|
||
|
|
query r1p1 at r1;
|
||
|
|
|
||
|
|
###############################################################################
|
||
|
|
|
||
|
|
let mr2 = [ const movingregion value (((0.0 10.0 TRUE FALSE)
|
||
|
|
(((( 0.0 0.0 50.0 50.0)
|
||
|
|
( 0.0 100.0 50.0 150.0)
|
||
|
|
(100.0 100.0 150.0 150.0)
|
||
|
|
(100.0 0.0 150.0 50.0))
|
||
|
|
(( 25.0 25.0 75.0 75.0)
|
||
|
|
( 25.0 75.0 75.0 125.0)
|
||
|
|
( 75.0 75.0 125.0 125.0)
|
||
|
|
( 75.0 25.0 125.0 75.0)))))) ];
|
||
|
|
|
||
|
|
let mr2p1 = [ const point value (30.0 30.0) ];
|
||
|
|
|
||
|
|
#testcase "o - at"
|
||
|
|
#yields (mpoint ((("2000-01-04" "2000-01-09" TRUE TRUE) (30.0 30.0 30.0 30.0))))
|
||
|
|
query mr2 at mr2p1;
|
||
|
|
|
||
|
|
#teardown
|
||
|
|
close database;
|
||
|
|
delete database mratest;
|