MCPcopy Create free account
hub / github.com/Gecode/gecode / run

Method run

test/afc.cpp:85–132  ·  view source on GitHub ↗

Perform actual tests

Source from the content-addressed store, hash-verified

83 AFC(void) : Test::Base("AFC") {}
84 /// Perform actual tests
85 bool run(void) {
86 // Array of spaces for tests
87 TestSpace* s[n];
88 // How many spaces exist in s
89 int n_s = 1;
90
91 for (int i=n; i--; )
92 s[i] = nullptr;
93 s[0] = new TestSpace;
94
95 for (int o=n_ops; o--; )
96 switch (_rand(3)) {
97 case 0:
98 // clone space
99 {
100 int i = index();
101 if ((s[i] != nullptr)) {
102 if (n_s > 1) {
103 delete s[i]; s[i]=nullptr; n_s--;
104 } else {
105 break;
106 }
107 }
108 int j = space(s);
109 (void) s[j]->status();
110 s[i] = static_cast<TestSpace*>(s[j]->clone());
111 n_s++;
112 }
113 break;
114 case 1:
115 // delete space
116 if (n_s > 1) {
117 int i = space(s);
118 delete s[i]; s[i]=nullptr; n_s--;
119 }
120 break;
121 case 2:
122 // post propagator
123 s[space(s)]->post();
124 break;
125 default:
126 GECODE_NEVER;
127 }
128 // Delete all remaining spaces
129 for (int i=n; i--; )
130 delete s[i];
131 return true;
132 }
133 };
134
135 AFC afc;

Callers

nothing calls this directly

Calls 3

statusMethod · 0.45
cloneMethod · 0.45
postMethod · 0.45

Tested by

no test coverage detected