[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Libguestfs] [PATCH 4/9] v2v: Add unit test of Utils.drive_name function.



---
 v2v/v2v_unit_tests.ml | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/v2v/v2v_unit_tests.ml b/v2v/v2v_unit_tests.ml
index aa27b9f..1b84ed0 100644
--- a/v2v/v2v_unit_tests.ml
+++ b/v2v/v2v_unit_tests.ml
@@ -82,11 +82,24 @@ let test_get_ostype ctx =
                                         i_product_variant = "Server";
                                         i_arch = "x86_64" })
 
+let test_drive_name ctx =
+  let printer = identity in
+  assert_equal ~printer "a" (Utils.drive_name 0);
+  assert_equal ~printer "z" (Utils.drive_name 25);
+  assert_equal ~printer "aa" (Utils.drive_name 26);
+  assert_equal ~printer "ab" (Utils.drive_name 27);
+  assert_equal ~printer "az" (Utils.drive_name 51);
+  assert_equal ~printer "ba" (Utils.drive_name 52);
+  assert_equal ~printer "zz" (Utils.drive_name 701);
+  assert_equal ~printer "aaa" (Utils.drive_name 702);
+  assert_equal ~printer "zzz" (Utils.drive_name 18277)
+
 (* Suites declaration. *)
 let suite =
   "virt-v2v" >:::
     [
       "OVF.get_ostype" >:: test_get_ostype;
+      "Utils.drive_name" >:: test_drive_name;
     ]
 
 let () =
-- 
2.3.1


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]