-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add zlib smoke test and refactor zlib cmake (#1190)
* refactor zlib cmake and add smoke test * update * updates index 53ed31e5a..a900e48f9 100644 * fix typo with zlib smoke buffer sizes
- Loading branch information
Showing
5 changed files
with
85 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Copyright (c) Lawrence Livermore National Security, LLC and other Conduit | ||
# Project developers. See top-level LICENSE AND COPYRIGHT files for dates and | ||
# other details. No copyright assignment is required to contribute to Conduit. | ||
############################################################################### | ||
# | ||
|
||
############################################################################### | ||
# | ||
# Setup ZLIB | ||
# | ||
############################################################################### | ||
|
||
if(ZLIB_DIR) | ||
set(ZLIB_ROOT ${ZLIB_DIR}) | ||
find_package(ZLIB REQUIRED) | ||
endif() | ||
|
||
message(STATUS "ZLIB_LIBRARIES: ${ZLIB_LIBRARIES}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
// Copyright (c) Lawrence Livermore National Security, LLC and other Conduit | ||
// Project developers. See top-level LICENSE AND COPYRIGHT files for dates and | ||
// other details. No copyright assignment is required to contribute to Conduit. | ||
|
||
//----------------------------------------------------------------------------- | ||
/// | ||
/// file: t_zlib_smoke.cpp | ||
/// | ||
//----------------------------------------------------------------------------- | ||
|
||
#include "gtest/gtest.h" | ||
#include "zlib.h" | ||
|
||
//----------------------------------------------------------------------------- | ||
TEST(zlib_smoke, zlib_basic) | ||
{ | ||
|
||
// exercise compress and uncompress interface | ||
|
||
Bytef compress_src[32]; | ||
Bytef compress_dest[64]; | ||
Bytef uncompress_dest[64]; | ||
|
||
uLongf compress_src_len = 32; | ||
uLongf compress_dest_len = 64; | ||
uLongf uncompress_dest_len = 64; | ||
|
||
for(int i=0;i<32;i++) | ||
{ | ||
compress_dest[i] = 0; | ||
uncompress_dest[i] = 0; | ||
// some pattern | ||
compress_dest[i] = i > 4 && i < 28; | ||
} | ||
|
||
int compress_res = compress(compress_dest, | ||
&compress_dest_len, | ||
compress_src, | ||
compress_src_len); | ||
|
||
EXPECT_EQ(Z_OK,compress_res); | ||
|
||
|
||
int uncompress_res = uncompress(uncompress_dest, | ||
&uncompress_dest_len, | ||
compress_dest, | ||
compress_dest_len); | ||
EXPECT_EQ(Z_OK,uncompress_res); | ||
|
||
for(int i=0;i<32;i++) | ||
{ | ||
EXPECT_EQ(compress_src[i],uncompress_dest[i]); | ||
} | ||
} | ||
|