public function testDeleteExpired() { CMTest_TH::timeInit(); $runtime = new CM_Cache_Storage_Runtime(); $runtime->set('foo', true); $this->assertTrue($runtime->get('foo')); CMTest_TH::timeForward(5); $runtime->set('bar', true); $this->assertFalse($runtime->get('foo')); }
public function testTrainChanged() { $svm = new CM_SVM_Model(1); CMTest_TH::timeInit(); CMTest_TH::timeForward(10); $svm->addTraining(-1, array(1 => 1.0, 2 => 0.0)); $svm->addTraining(1, array(1 => 0.0, 2 => 1.0)); $this->assertNotSame(1, $svm->predict(array(1 => 0.0, 2 => 1.0))); CM_SVM_Model::trainChanged(); $svm = new CM_SVM_Model(1); $this->assertSame(1, $svm->predict(array(1 => 0.0, 2 => 1.0))); $svm->flush(); }