summaryrefslogtreecommitdiff
path: root/src/tests
diff options
context:
space:
mode:
authorMagnus Lundborg <lundborg.magnus@gmail.com>2014-06-16 06:06:21 (GMT)
committerMagnus Lundborg <lundborg.magnus@gmail.com>2014-06-16 14:30:04 (GMT)
commit7ab14b626e870185251a19d28031e60f237d92cb (patch)
treedd9692955699340b37c86e3655f15446b517656e /src/tests
parent4019fd9081241aca8a054252fcb5654297888a38 (diff)
Migrating data blocks [WIP].
Also includes some simple tests to verify that it is working. Change-Id: I6d465000a6fd202d53af033d7e839bfecdccc068
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/tng_io_testing.c38
1 files changed, 36 insertions, 2 deletions
diff --git a/src/tests/tng_io_testing.c b/src/tests/tng_io_testing.c
index 17718d0..dd13d92 100644
--- a/src/tests/tng_io_testing.c
+++ b/src/tests/tng_io_testing.c
@@ -1,7 +1,7 @@
/* This code is part of the tng binary trajectory format.
*
* Written by Magnus Lundborg
- * Copyright (c) 2012-2013, The GROMACS development team.
+ * Copyright (c) 2012-2014, The GROMACS development team.
* Check out http://www.gromacs.org for more information.
*
*
@@ -147,6 +147,9 @@ static tng_function_status tng_test_write_and_read_traj(tng_trajectory_t *traj)
tng_medium_stride_length_set(*traj, 10);
tng_long_stride_length_set(*traj, 100);
+ tng_first_user_name_set(*traj, "User1");
+ tng_first_program_name_set(*traj, "tng_testing");
+
/* Create molecules */
if(tng_test_setup_molecules(*traj) == TNG_CRITICAL)
{
@@ -210,7 +213,7 @@ static tng_function_status tng_test_write_and_read_traj(tng_trajectory_t *traj)
/* Generate a custom annotation data block */
strcpy(annotation, "This trajectory was generated from tng_io_testing. "
"It is not a real MD trajectory.");
- if(tng_data_block_add(*traj, 10100, "DETAILS", TNG_CHAR_DATA,
+ if(tng_data_block_add(*traj, TNG_TRAJ_GENERAL_COMMENTS, "COMMENTS", TNG_CHAR_DATA,
TNG_NON_TRAJECTORY_BLOCK, 1, 1, 1, TNG_UNCOMPRESSED,
annotation) != TNG_SUCCESS)
{
@@ -567,6 +570,26 @@ tng_function_status tng_test_get_positions_data(tng_trajectory_t traj)
return(TNG_SUCCESS);
}
+
+tng_function_status tng_test_append(tng_trajectory_t traj)
+{
+ tng_function_status stat;
+
+ stat = tng_util_trajectory_open(TNG_EXAMPLE_FILES_DIR "tng_test.tng", 'a', &traj);
+ if(stat != TNG_SUCCESS)
+ {
+ return(stat);
+ }
+
+ tng_last_user_name_set(traj, "User2");
+ tng_last_program_name_set(traj, "tng_testing");
+ tng_file_headers_write(traj, TNG_USE_HASH);
+
+ stat = tng_util_trajectory_close(&traj);
+
+ return(stat);
+}
+
int main()
{
tng_trajectory_t traj;
@@ -681,6 +704,17 @@ int main()
printf("Test Utility function close:\t\t\tSucceeded.\n");
}
+ if(tng_test_append(traj) != TNG_SUCCESS)
+ {
+ printf("Test Append:\t\t\t\t\tFailed. %s: %d.\n",
+ __FILE__, __LINE__);
+ exit(1);
+ }
+ else
+ {
+ printf("Test Append:\t\t\t\t\tSucceeded.\n");
+ }
+
printf("Tests finished\n");
exit(0);
contact: Jan Huwald // Impressum