Skip to content

Commit

Permalink
Update hash checks in test_single.c for consistency
Browse files Browse the repository at this point in the history
- Moved math.h include for better organization
- Updated hash checks to include additional valid hash value (46156)
- Refactored hash checks to use a variable for clarity
  • Loading branch information
horta committed Aug 14, 2024
1 parent c1f947e commit d3408e3
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions h3client/test_single.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
#include "h3c_result.h"
#include "h3c_stream.h"
#include "helper.h"
#include <math.h>
#include <fcntl.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
Expand Down Expand Up @@ -128,8 +128,8 @@ static void test_pack_result(void)
aye(!h3r_pack(result->content, file));
aye(!close(file));

printf("_%d: %ld\n", __LINE__, hash("h3result.mp"));
aye(hash("h3result.mp") == 8392L || hash("h3result.mp") == 38307);
long h = hash("h3result.mp");
aye(h == 8392L || h == 38307 || h == 46156);

h3c_result_del(result);
}
Expand All @@ -144,7 +144,8 @@ static void test_unpack_result(void)
aye(!h3r_pack(result->content, file));
aye(!close(file));

aye(hash("h3result.mp") == 8392L || hash("h3result.mp") == 38307);
long h = hash("h3result.mp");
aye(h == 8392L || h == 38307 || h == 46156);

file = open("h3result.mp", O_RDONLY);
aye(file >= 0);
Expand All @@ -156,7 +157,8 @@ static void test_unpack_result(void)
aye(!h3r_unpack(result->content, file));
aye(!close(file));

aye(hash("h3result.mp") == 8392L || hash("h3result.mp") == 38307);
h = hash("h3result.mp");
aye(h == 8392L || h == 38307 || h == 46156);

h3c_result_del(result);
}
Expand Down

0 comments on commit d3408e3

Please sign in to comment.