Skip to content

Commit

Permalink
no svb tests for bigendian as this feature is not available
Browse files Browse the repository at this point in the history
  • Loading branch information
hasindu2008 committed May 5, 2024
1 parent 58ee4a7 commit d5d9467
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions test/unit_test_press.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,19 @@
#include <slow5/slow5.h>
#include <string.h>

static inline int is_big_endian(void)
{
long one= 1;
return !(*((char *)(&one)));
}

static inline void dont_run_on_bigendian(){
if(is_big_endian()){
fprintf(stderr,"Not running as this feature is not there for big-endian\n");
exit(EXIT_SUCCESS);
}
}

int press_init_valid(void) {
struct __slow5_press *comp = __slow5_press_init(SLOW5_COMPRESS_NONE);
ASSERT(comp->method == SLOW5_COMPRESS_NONE);
Expand Down Expand Up @@ -104,6 +117,8 @@ int press_printf_valid(void) {

int press_svb_one_valid(void) {

dont_run_on_bigendian();

const int16_t one[] = { 100 };
size_t bytes_svb = 0;
uint8_t *one_svb = slow5_ptr_compress_solo(SLOW5_COMPRESS_SVB_ZD, one, sizeof *one, &bytes_svb);
Expand All @@ -123,11 +138,15 @@ int press_svb_one_valid(void) {
free(one_svb);
free(one_depress);

fprintf(stderr, "Ran press_svb_one_valid\n");

return EXIT_SUCCESS;
}

int press_svb_big_valid(void) {

dont_run_on_bigendian();

const int16_t big[] = { 100, -100, 0, 10000, 3442, 234, 2326, 346, 213, 234 };
size_t bytes_svb = 0;
uint8_t *big_svb = slow5_ptr_compress_solo(SLOW5_COMPRESS_SVB_ZD, big, sizeof big, &bytes_svb);
Expand All @@ -146,11 +165,15 @@ int press_svb_big_valid(void) {
free(big_svb);
free(big_depress);

fprintf(stderr, "Ran press_svb_big_valid\n");

return EXIT_SUCCESS;
}

int press_svb_exp_valid(void) {

dont_run_on_bigendian();

const int16_t big[] = { 1039, 588, 588, 593, 586, 574, 570, 585, 588, 586 };
size_t bytes_svb = 0;
uint8_t *big_svb = slow5_ptr_compress_solo(SLOW5_COMPRESS_SVB_ZD, big, sizeof big, &bytes_svb);
Expand All @@ -170,6 +193,8 @@ int press_svb_exp_valid(void) {
free(big_svb);
free(big_depress);

fprintf(stderr, "Ran press_svb_exp_valid\n");

return EXIT_SUCCESS;
}

Expand Down

0 comments on commit d5d9467

Please sign in to comment.