8 # ======================================================================
9 # $set = new Bit::Vector($elements);
18 # $set1->equal($set2);
19 # ======================================================================
23 print "1..", ($limit+4)*2, "\n";
25 @prime = (0) x ($limit+1);
196 $set1 = new Bit::Vector($limit+1);
197 $set2 = new Bit::Vector($limit+1);
198 $set3 = new Bit::Vector($limit+1);
209 for ( $j = 4; $j <= $limit; $j += 2 )
215 for ( $i = 3; ($j = $i * $i) <= $limit; $i += 2 )
217 for ( ; $j <= $limit; $j += $i )
225 for ( $i = 0; $i <= $limit; ++$i )
227 if ($set1->contains($i) == $prime[$i])
228 {print "ok $n\n";} else {print "not ok $n\n";}
230 if ($set2->bit_flip($i) == $prime[$i])
231 {print "ok $n\n";} else {print "not ok $n\n";}
235 if ($set1->Norm() == 168)
236 {print "ok $n\n";} else {print "not ok $n\n";}
239 if ($set2->Norm() == 168)
240 {print "ok $n\n";} else {print "not ok $n\n";}
243 if ($set3->Norm() == 168)
244 {print "ok $n\n";} else {print "not ok $n\n";}
247 if ($set1->equal($set2))
248 {print "ok $n\n";} else {print "not ok $n\n";}
251 if ($set1->equal($set3))
252 {print "ok $n\n";} else {print "not ok $n\n";}
255 if ($set2->equal($set3))
256 {print "ok $n\n";} else {print "not ok $n\n";}