1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137
|
#
# Tests for functions defined in src/listfunc.c
#
gap> START_TEST("kernel/listfunc.tst");
#
gap> l:=Immutable([1,2,3]);
[ 1, 2, 3 ]
gap> Add(l, 0, 1);
Error, List Assignment: <list> must be a mutable list
gap> Remove([]);
Error, Remove: <list> must not be empty
# The following test does not work (instead produces a "method not found" error).
# The difference to 'Add' is that for 'Add', we install a custom handler func
# for both 2 and 3 arguments, which we don't do for 'Remove'; so the regular
# operation handler runs, which validates the arguments and produces the "method not
# found" error before in RemPlist for immutable lists is reached.
# gap> Remove(l, 1);
# Error, List Assignment: <list> must be a mutable list
#
gap> APPEND_LIST_INTR(fail, fail);
Error, APPEND_LIST_INTR: <list1> must be a mutable list (not the value 'fail')
gap> APPEND_LIST_INTR(rec(), fail);
Error, APPEND_LIST_INTR: <list1> must be a small list (not a record (plain))
#
gap> POSITION_SORTED_LIST(fail, fail);
Error, POSITION_SORTED_LIST: <list> must be a small list (not the value 'fail'\
)
#
gap> POSITION_SORTED_LIST_COMP(fail, fail, fail);
Error, POSITION_SORTED_LIST_COMP: <list> must be a small list (not the value '\
fail')
gap> POSITION_SORTED_LIST_COMP([], 1, fail);
Error, POSITION_SORTED_LIST_COMP: <func> must be a function (not the value 'fa\
il')
gap> POSITION_SORTED_LIST_COMP([1,2,3], 3, \<);
3
gap> POSITION_SORTED_LIST_COMP([1..3], 3, \<);
3
gap> POSITION_SORTED_LIST_COMP([1..3], fail, \<);
4
gap> POSITION_SORTED_LIST_COMP([1..3], 0, \<);
1
#
gap> SORT_LIST(fail);
Error, SORT_LIST: <list> must be a small list (not the value 'fail')
#
gap> STABLE_SORT_LIST(fail);
Error, STABLE_SORT_LIST: <list> must be a small list (not the value 'fail')
#
gap> SORT_LIST_COMP(fail, fail);
Error, SORT_LIST_COMP: <list> must be a small list (not the value 'fail')
gap> SORT_LIST_COMP([], fail);
Error, SORT_LIST_COMP: <func> must be a function (not the value 'fail')
#
gap> STABLE_SORT_LIST_COMP(fail, fail);
Error, STABLE_SORT_LIST_COMP: <list> must be a small list (not the value 'fail\
')
gap> STABLE_SORT_LIST_COMP([], fail);
Error, STABLE_SORT_LIST_COMP: <func> must be a function (not the value 'fail')
#
gap> SORT_PARA_LIST(fail, fail);
Error, SORT_PARA_LIST: <list> must be a small list (not the value 'fail')
gap> SORT_PARA_LIST([], fail);
Error, SORT_PARA_LIST: <shadow> must be a small list (not the value 'fail')
gap> SORT_PARA_LIST([], [1]);
Error, SORT_PARA_LIST: <list> must have the same length as <shadow> (lengths a\
re 0 and 1)
#
gap> STABLE_SORT_PARA_LIST(fail, fail);
Error, STABLE_SORT_PARA_LIST: <list> must be a small list (not the value 'fail\
')
gap> STABLE_SORT_PARA_LIST([], fail);
Error, STABLE_SORT_PARA_LIST: <shadow> must be a small list (not the value 'fa\
il')
gap> STABLE_SORT_PARA_LIST([], [1]);
Error, STABLE_SORT_PARA_LIST: <list> must have the same length as <shadow> (le\
ngths are 0 and 1)
#
gap> OnPairs(fail,fail);
Error, OnPairs: <pair> must be a small list (not the value 'fail')
gap> OnPairs([1],fail);
Error, OnPairs: <pair> must have length 2, not length 1
gap> OnPairs([1,2], true);
Error, no method found! For debugging hints type ?Recovery from NoMethodFound
Error, no 1st choice method found for `^' on 2 arguments
gap> OnPairs([1,2],(2,3));
[ 1, 3 ]
#
gap> OnTuples(fail,fail);
Error, OnTuples: <tuple> must be a small list (not the value 'fail')
gap> OnTuples([],fail);
[ ]
gap> OnTuples([1,2], true);
Error, no method found! For debugging hints type ?Recovery from NoMethodFound
Error, no 1st choice method found for `^' on 2 arguments
gap> OnTuples([1,2],(2,3));
[ 1, 3 ]
#
gap> OnSets(fail,fail);
Error, OnSets: <set> must be a set (not the value 'fail')
gap> OnSets([2,1],fail);
Error, OnSets: <set> must be a set (not a non-strictly-sorted plain list of cy\
clotomics)
gap> OnSets([1,2], true);
Error, no method found! For debugging hints type ?Recovery from NoMethodFound
Error, no 1st choice method found for `^' on 2 arguments
gap> OnSets([1,2],(2,3));
[ 1, 3 ]
gap> empty:=[];;
gap> IsIdenticalObj(empty, OnSets(empty, ()));
false
gap> empty:=Immutable([]);;
gap> IsIdenticalObj(empty, OnSets(empty, ()));
true
#
gap> STRONGLY_CONNECTED_COMPONENTS_DIGRAPH(fail);
Error, Length: <list> must be a list (not the value 'fail')
gap> STRONGLY_CONNECTED_COMPONENTS_DIGRAPH([]);
[ ]
#
gap> STOP_TEST("kernel/listfunc.tst");
|