Data-CountMinSketch-Shared

 view release on metacpan or  search on metacpan

t/03-frozen.t  view on Meta::CPAN

    my $A = Data::CountMinSketch::Shared->new(undef, 0.01, 0.01);   # same geometry
    $A->add("local");
    $A->merge($Bro);   # must read Bro's cells without locking its PROT_READ map
    cmp_ok $A->estimate("local"), '>=', 1, 'merge target keeps its own items';
    cmp_ok $A->estimate($_), '>=', 1, "merged-in '$_' present after merge from frozen other" for qw(xx yy zz);
    is $A->total, 1 + 3, 'merge target total includes its own add plus the frozen other';
}

done_testing;

# minimal exception helper (avoid a Test::Fatal dependency)
sub exception {
    my $code = shift;
    my $err;
    { local $@; eval { $code->(); 1 } or $err = $@; }
    return $err;
}



( run in 1.205 second using v1.01-cache-2.11-cpan-54e63673c56 )