rangeorder.sa
Generated by gen_html_sa_files from ICSI. Contact gomes@icsi.berkeley.edu for details
class TEST_RANGE_ORDERING
class TEST_RANGE_ORDERING is
-- This is a test program to test the cultural character repertoire
-- class. Note that it is not portable for simplicity in building a local
-- library.
-- Version 1.0 Oct 97. Copyright K Hopper, U of Waikato
-- Development History
-- -------------------
-- Date Who By Detail
-- ---- ------ ------
-- 15 Oct 97 kh Original
include TEST ;
main is
class_name("RANGE_ORDERING") ;
rules : ARRAY{ORDER_RULE} := ARRAY{ORDER_RULE}::create(
|
ORDER_RULE::create(true,true),
ORDER_RULE::create(true,false),
ORDER_RULE::create(false,true),
ORDER_RULE::create(true,true),
ORDER_RULE::create(false,false)
|) ;
wts : ARRAY{ORDER_WEIGHT} := ARRAY{ORDER_WEIGHT}::create(
|
ORDER_WEIGHT::create(2),
ORDER_WEIGHT::create(4),
ORDER_WEIGHT::create(6),
ORDER_WEIGHT::create(8),
ORDER_WEIGHT::create(CARD::maxval)
|) ;
order : RANGE_ORDERING := RANGE_ORDERING::create(
RANGE::create(42,999),
ORDER_WEIGHT::create(100),
rules,
wts
) ;
loc_tok : TOKEN := TOKEN::create(42) ;
tok_list : FLIST{TOKEN} := FLIST{TOKEN}::create.push(loc_tok) ;
test("contains " + loc_tok.str,order.contains(loc_tok).str,true.str) ;
loc_tok := TOKEN::create(1000) ;
test("contains " + loc_tok.str,order.contains(loc_tok).str,false.str) ;
loc_tok := TOKEN::create(42) ;
res : ARRAY{ORDER_WEIGHT} := order.weights(loc_tok) ;
res_str : ARRAY{STR} := ARRAY{STR}::create(wts.asize) ;
loop
res_str.set!(res.elt!.card.str)
end ;
ok_str : ARRAY{STR} := ARRAY{STR}::create(
|2.str,
4.str,
6.str,
8.str,
100.str
|) ;
test("weights",res_str,ok_str) ;
finish
end ;
end ; -- TEST_RANGE_ORDERING