changeset 1861:561317debc8d

Add a test for miset_world_origin(), changed some function names
author bert <bert>
date Wed, 11 Aug 2004 20:34:38 +0000
parents 1ea25f99c345
children 0ca40a05853a
files libsrc2/test/convert-test.c
diffstat 1 files changed, 26 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libsrc2/test/convert-test.c
+++ b/libsrc2/test/convert-test.c
@@ -102,9 +102,9 @@
                 voxel[1] = coords[1];
                 voxel[2] = coords[2];
 
-                miconvert_3D_voxel_to_world(hvol, voxel, world);
+                miconvert_voxel_to_world(hvol, voxel, world);
         
-                miconvert_3D_world_to_voxel(hvol, world, new_voxel);
+                miconvert_world_to_voxel(hvol, world, new_voxel);
 
                 for (n = 0; n < 3; n++) {
                     if (!NEARLY_EQUAL(voxel[n], new_voxel[n])) {
@@ -184,6 +184,30 @@
         }
     }
 
+    world[MI2_X] = -80;
+    world[MI2_Y] = 150;
+    world[MI2_Z] = 120;
+
+    result = miset_world_origin(hvol, world);
+
+    if (result != MI_NOERROR) {
+        TESTRPT("miset_world_origin error", result);
+    }
+
+    voxel[MI2_X] = voxel[MI2_Y] = voxel[MI2_Z] = 0;
+
+    result = miconvert_voxel_to_world(hvol, voxel, world);
+    if (result != MI_NOERROR) {
+        TESTRPT("miconvert_voxel_to_world error", result);
+    }
+
+    if (!NEARLY_EQUAL(world[MI2_X], -80.0) || 
+        !NEARLY_EQUAL(world[MI2_Y], 150.0) || 
+        !NEARLY_EQUAL(world[MI2_Z], 120.0)) {
+        fprintf(stderr, "%f %f %f\n", world[0], world[1], world[2]);
+        TESTRPT("conversion error", 0);
+    }
+
     if (error_cnt == 0) {
         printf("No errors\n");
     }