MCPcopy Create free account
hub / github.com/apple/coremltools / testRangeValDivide

Function testRangeValDivide

mlmodel/tests/NNShapeTests.cpp:188–222  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

186}
187
188int testRangeValDivide() {
189
190 RangeValue r1;
191 RangeValue r2(1);
192 RangeValue r3(5);
193 RangeValue r4(12);
194
195 RangeValue r5 = r1.divideAndRoundUp(r2);
196 ML_ASSERT(r5.isUnbound());
197
198 bool catch_me = false;
199 try {
200 RangeValue r6 = r2.divideAndRoundUp(r1);
201 ML_ASSERT(r6.isUnbound()); // just to quiet the compiler
202 }
203 catch (std::runtime_error& err) {
204 catch_me = true;
205 }
206 ML_ASSERT(catch_me);
207
208 RangeValue r7 = r2.divideAndRoundUp(r3);
209 ML_ASSERT(r7.value() == 1);
210
211 RangeValue r8 = r3.divideAndRoundUp(r2);
212 ML_ASSERT(r8.value() == 5);
213
214 RangeValue r9 = r3.divideAndRoundUp(r4);
215 ML_ASSERT(r9.value() == 1);
216
217 RangeValue r10 = r4.divideAndRoundUp(r3);
218 ML_ASSERT(r10.value() == 3);
219
220 return 0;
221
222}
223
224int testShapeRange() {
225

Callers

nothing calls this directly

Calls 3

divideAndRoundUpMethod · 0.80
isUnboundMethod · 0.80
valueMethod · 0.45

Tested by

no test coverage detected