diff options
author | Aris Adamantiadis <aris@0xbadc0de.be> | 2010-05-08 22:22:06 +0200 |
---|---|---|
committer | Aris Adamantiadis <aris@0xbadc0de.be> | 2010-05-08 22:22:06 +0200 |
commit | 31cc03f8e63f5b748dfe04a1e826c5477eaa805d (patch) | |
tree | 3d7f77f3c068f67d2e04aec2d482f3c03a9de464 /tests/unittests | |
parent | cf7449c525ba24fe17bc0d4578c9f6ce8925c6e8 (diff) | |
download | libssh-31cc03f8e63f5b748dfe04a1e826c5477eaa805d.tar.gz libssh-31cc03f8e63f5b748dfe04a1e826c5477eaa805d.tar.xz libssh-31cc03f8e63f5b748dfe04a1e826c5477eaa805d.zip |
added test for ntohll
Diffstat (limited to 'tests/unittests')
-rw-r--r-- | tests/unittests/torture_misc.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/unittests/torture_misc.c b/tests/unittests/torture_misc.c index bcede39..bde0613 100644 --- a/tests/unittests/torture_misc.c +++ b/tests/unittests/torture_misc.c @@ -50,12 +50,31 @@ START_TEST (torture_dirname) } END_TEST +START_TEST (torture_ntohll) +{ + u_int32_t sample = 1; + unsigned char *ptr=(unsigned char *) &sample; + u_int64_t value = 0x0123456789abcdef; + u_int64_t check; + if(ptr[0]==1){ + /* we're in little endian */ + check = 0xefcdab8967452301; + } else { + /* big endian */ + check = value; + } + value=ntohll(value); + ck_assert(value == check); +} +END_TEST + static Suite *torture_make_suite(void) { Suite *s = suite_create("libssh_misc"); torture_create_case(s, "torture_get_user_home_dir", torture_get_user_home_dir); torture_create_case(s, "torture_basename", torture_basename); torture_create_case(s, "torture_dirname", torture_dirname); + torture_create_case(s, "torture_ntohll", torture_ntohll); return s; } |