private function _runTests(SharedMemory $mem) { foreach (self::$_testValues as $type => $value) { $this->assertEquals($value, $mem->getVar($type), 'Equality test failed for variable "' . $type . '".'); } // Test in-place addition $val = $mem->getVar('integer'); $operand = 20; $mem->addToVar('integer', $operand); $this->assertEquals($val + $operand, $mem->getVar('integer')); $val = $mem->getVar('float'); $operand = -283.5; $mem->addToVar('float', $operand); $this->assertEquals(round($val + $operand, 2), round($mem->getVar('float'), 2)); // Now clear them out for the next test and make sure they're gone $this->_removeValues($mem); foreach (self::$_testValues as $type => $value) { $this->assertFalse($mem->hasVar($type)); } }