Skip to content

Commit

Permalink
Tests: change precision approach in Cluster2
Browse files Browse the repository at this point in the history
  • Loading branch information
shawnlaffan committed Mar 8, 2024
1 parent 9231550 commit 1de8221
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions t/26-Cluster2.t
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ sub test_cluster_node_calcs {

is [sort keys %$node_hash1], [sort keys %$node_hash2], 'paranoia check: same node names';

my $prec = 1e10;
my (%aggregate1, %aggregate2);
foreach my $node_name (sort keys %$node_hash1) {
my $node1 = $node_hash1->{$node_name};
Expand All @@ -258,8 +259,8 @@ sub test_cluster_node_calcs {
foreach my $list_name (sort grep {$_ !~ /NODE_VALUES/}$node1->get_hash_lists) {
my $ref1 = $node1->get_list_ref_aa($list_name);
my $ref2 = $node2->get_list_ref_aa($list_name);
my $snapped1 = {map {$_ => sprintf "%.10f", $ref1->{$_}} keys %$ref1};
my $snapped2 = {map {$_ => sprintf "%.10f", $ref2->{$_}} keys %$ref2};
my $snapped1 = {map {$_ => int ($ref1->{$_} * $prec)/$prec} keys %$ref1};
my $snapped2 = {map {$_ => int ($ref2->{$_} * $prec)/$prec} keys %$ref2};
$aggregate1{$node_name}{$list_name} = $snapped1;
$aggregate2{$node_name}{$list_name} = $snapped2;
}
Expand Down

0 comments on commit 1de8221

Please sign in to comment.