Bumped the TNG library to the latest version.
[alexxy/gromacs.git] / src / external / tng_io / src / tests / tng_io_testing.c
index 973ac4fb7b6268c0c5f2e9133f2133382fb9e7db..dd13d925d3dd3bfb39d9276519694bed4932559f 100644 (file)
@@ -1,9 +1,7 @@
 /* This code is part of the tng binary trajectory format.
- *
- *                      VERSION 1.0
  *
  * 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.
  *
  *
@@ -149,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)
     {
@@ -212,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)
     {
@@ -569,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;
@@ -683,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);