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

Method testFloat

deps/protobuf/php/tests/MapFieldTest.php:256–272  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

254 #########################################################
255
256 public function testFloat() {
257 $arr = new MapField(GPBType::INT32, GPBType::FLOAT);
258
259 // Test set.
260 $arr[0] = 1;
261 $this->assertFloatEquals(1.0, $arr[0], MAX_FLOAT_DIFF);
262
263 $arr[1] = 1.1;
264 $this->assertFloatEquals(1.1, $arr[1], MAX_FLOAT_DIFF);
265
266 $arr[2] = '2';
267 $this->assertFloatEquals(2.0, $arr[2], MAX_FLOAT_DIFF);
268 $arr[3] = '3.1';
269 $this->assertFloatEquals(3.1, $arr[3], MAX_FLOAT_DIFF);
270
271 $this->assertEquals(4, count($arr));
272 }
273
274 #########################################################
275 # Test double field.

Callers

nothing calls this directly

Calls 2

countFunction · 0.85
assertFloatEqualsMethod · 0.80

Tested by

no test coverage detected