/* * Insert to array **/ $stat['array']['insert']['s'] = get_stat(); for ($i = 0; $i < $number; $i++) { $array[] = $vars[$i]; } $stat['array']['insert']['e'] = get_stat(); while (count($check) < $number / 2) { $check[] = substr(str_shuffle("ABCDEFGHIJKLMNOPQRSTUVWXYZ"), 0, 10); } /* * Check existance with bloom **/ $stat['bloom']['has']['s'] = get_stat(); $stat['bloom']['has']['errors'] = $bloom->has($check); $stat['bloom']['has']['e'] = get_stat(); /* * Check existance in array **/ $stat['array']['has']['s'] = get_stat(); for ($i = 0; $i < $number; $i++) { $stat['array']['has']['errors'][] = @in_array($check[$i], $array); } $stat['array']['has']['e'] = get_stat(); /* * Delete from bloom **/ $stat['bloom']['delete']['s'] = get_stat(); $bloom->delete($check); $stat['bloom']['delete']['e'] = get_stat();
public function testUnsetTestManyToManyValue() { $params = array('counter' => true); $bloom = new Bloom($params); for ($i = 0; $i < 10; $i++) { $vars[] = substr(str_shuffle("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"), 0, 5); $res[] = true; } $bloom->set($vars); $this->assertEquals($res, $bloom->has($vars)); $this->assertEquals($res, $bloom->delete($vars)); $set = explode(',', $bloom->set); $this->assertEquals(0, array_sum($set)); }