summaryrefslogtreecommitdiff
path: root/src/tests/tng_io_testing.c
diff options
context:
space:
mode:
authorMagnus Lundborg <lundborg.magnus@gmail.com>2013-06-25 06:09:33 (GMT)
committerMagnus Lundborg <lundborg.magnus@gmail.com>2013-06-25 06:09:33 (GMT)
commit52f24b0d4d6754a7d3ee70dabd0b5859eeae6e03 (patch)
tree6bec4094f298fa10413fb76cecead2f2af9b459a /src/tests/tng_io_testing.c
parentc627008cd60f362d340b78f89486a6d3cdf607e7 (diff)
Added test of utility opening and closing.
Open and close file using utility functions. More tests of the high-level API will be added.
Diffstat (limited to 'src/tests/tng_io_testing.c')
-rw-r--r--src/tests/tng_io_testing.c31
1 files changed, 30 insertions, 1 deletions
diff --git a/src/tests/tng_io_testing.c b/src/tests/tng_io_testing.c
index 6e8efb6..daabcc4 100644
--- a/src/tests/tng_io_testing.c
+++ b/src/tests/tng_io_testing.c
@@ -225,7 +225,7 @@ static tng_function_status tng_test_write_and_read_traj(tng_trajectory_t traj)
}
/* Write file headers (includes non trajectory data blocks */
- if(tng_file_headers_write(traj, TNG_USE_HASH) == TNG_CRITICAL)
+ if(tng_file_headers_write(traj, TNG_SKIP_HASH) == TNG_CRITICAL)
{
printf("Cannot write file headers.\n");
}
@@ -580,6 +580,7 @@ tng_function_status tng_test_get_positions_data(tng_trajectory_t traj)
int main()
{
tng_trajectory_t traj;
+ tng_function_status stat;
char time_str[TNG_MAX_DATE_STR_LEN];
if(tng_trajectory_init(&traj) != TNG_SUCCESS)
@@ -672,8 +673,36 @@ int main()
{
printf("Test Destroy trajectory:\t\t\tSucceeded.\n");
}
+
+#ifdef EXAMPLE_FILES_DIR
+ stat = tng_util_trajectory_open(EXAMPLE_FILES_DIR "tng_test.tng", 'r', &traj);
+#else
+ stat = tng_util_trajectory_open("/tmp/tng_test.tng", 'r', &traj);
+#endif
+ if(stat != TNG_SUCCESS)
+ {
+ printf("Test Utility function open:\t\t\tFailed. %s: %d.\n",
+ __FILE__, __LINE__);
+ exit(1);
+ }
+ else
+ {
+ printf("Test Utility function open:\t\t\tSucceeded.\n");
+ }
+ stat = tng_util_trajectory_close(&traj);
+ if(stat != TNG_SUCCESS)
+ {
+ printf("Test Utility function close:\t\t\tFailed. %s: %d.\n",
+ __FILE__, __LINE__);
+ exit(1);
+ }
+ else
+ {
+ printf("Test Utility function close:\t\t\tSucceeded.\n");
+ }
+
printf("Tests finished\n");
exit(0);
contact: Jan Huwald // Impressum