MCPcopy Create free account
hub / github.com/Singular/Singular / Main

Function Main

ppcc/adlib/test6.cc:17–59  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

15 }
16
17void Main() {
18 BitSet *set = new BitSet(256);
19 BitSet *set2 = new BitSet(256);
20 for (Int i = 0; i < 200; i += 2) {
21 set->set(i);
22 set2->set(i + 1);
23 }
24 for (Int i = 0; i < 200; i += 4) {
25 set2->set(i);
26 set2->clear(i + 1);
27 }
28 Check(set->count() == 100, "bitset count");
29 Check(set->union_with(set2)->count() == 150, "bitset union");
30 Check(set->intersect_with(set2)->count() == 50, "bitset intersection");
31 Check(set->diff_with(set2)->count() == 50, "bitset difference");
32 Int sum = 0;
33 for (BitSet::Each it(set); it; it++) {
34 sum += *it;
35 }
36 Check(sum == 99 * 100, "bitset iteration");
37 const Int n = 1000;
38 BitMatrix *mat = MakeBitMatrix(n, n);
39 for (Int i = 0; i < n; i++) {
40 mat->at(i)->set(i);
41 }
42 BitMatrix *mat2 = Transpose(mat);
43 CHECK_MAT(mat2, row == col, "bit matrix transposition");
44 mat2 = TransitiveClosure(mat);
45 CHECK_MAT(mat2, row == col, "transitive closure 1");
46 mat = MakeBitMatrix(n, n);
47 for (Int i = 1; i < n; i++) {
48 mat->at(i - 1)->set(i);
49 }
50 mat->at(n - 1)->set(0);
51 mat2 = TransitiveClosure(mat);
52 CHECK_MAT(mat2, true, "transitive closure 2");
53 mat = MakeBitMatrix(2, 2);
54 mat->at(1)->set(0);
55 mat->at(1)->set(0);
56 mat->at(1)->set(1);
57 mat2 = TransitiveClosure(mat);
58 CHECK_MAT(mat2, mat->at(row)->test(col), "transitive closure 3");
59}

Callers 1

run_with_gcFunction · 0.70

Calls 12

CheckFunction · 0.85
MakeBitMatrixFunction · 0.85
TransposeFunction · 0.85
TransitiveClosureFunction · 0.85
setMethod · 0.45
clearMethod · 0.45
countMethod · 0.45
union_withMethod · 0.45
intersect_withMethod · 0.45
diff_withMethod · 0.45
atMethod · 0.45
testMethod · 0.45

Tested by

no test coverage detected