From 6711bc6b994113a6850d4fc5eb35ab85ff560254 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Sat, 16 Feb 2019 10:09:42 +0100 Subject: [PATCH] Fixed tests in determinants --- CI/Determinant.ml | 17 +++++++++-------- CI/Spindeterminant.mli | 4 ++-- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/CI/Determinant.ml b/CI/Determinant.ml index ff62d3e..5079ba0 100644 --- a/CI/Determinant.ml +++ b/CI/Determinant.ml @@ -44,31 +44,32 @@ let test_case () = let det = of_lists l_a l_b in let z_a = alpha det and z_b = beta det in - Alcotest.(check (list int )) "alpha" (to_list z_a) l_a; - Alcotest.(check (list int )) "beta" (to_list z_b) l_b; - Alcotest.(check bool) "phase" (sgn det = 1.) true; + Alcotest.(check (list int )) "alpha" (Spindeterminant.to_list z_a) l_a; + Alcotest.(check (list int )) "beta" (Spindeterminant.to_list z_b) l_b; + Alcotest.(check bool) "phase" (phase det = Phase.Pos) true; in + let test_phase () = let l_a = [ 1 ; 2 ; 3 ; 64 ; 5 ] and l_b = [ 2 ; 3 ; 5 ; 65 ] in let det = of_lists l_a l_b in - Alcotest.(check bool) "phase" (sgn det = -1.) true; + Alcotest.(check bool) "phase" (phase det = Phase.Neg) true; let l_a = [ 1 ; 2 ; 3 ; 64 ; 5 ] and l_b = [ 3 ; 2 ; 5 ; 65 ] in let det = of_lists l_a l_b in - Alcotest.(check bool) "phase" (sgn det = 1.) true; + Alcotest.(check bool) "phase" (phase det = Phase.Pos) true; let l_a = [ 1 ; 3 ; 2 ; 64 ; 5 ] and l_b = [ 3 ; 2 ; 5 ; 65 ] in let det = of_lists l_a l_b in - Alcotest.(check bool) "phase" (sgn det = -1.) true; + Alcotest.(check bool) "phase" (phase det = Phase.Neg) true; let l_a = [ 1 ; 3 ; 2 ; 64 ; 5 ] and l_b = [ 3 ; 2 ; 65 ; 5 ] in let det = of_lists l_a l_b in - Alcotest.(check bool) "phase" (sgn det = 1.) true; + Alcotest.(check bool) "phase" (phase det = Phase.Pos) true; in [ "Creation", `Quick, test_creation; - "Phase" , `Quick, test_phase; + "Phase", `Quick, test_phase; ] diff --git a/CI/Spindeterminant.mli b/CI/Spindeterminant.mli index 9ab9658..3467145 100644 --- a/CI/Spindeterminant.mli +++ b/CI/Spindeterminant.mli @@ -10,12 +10,12 @@ type t val phase : t -> Phase.t (** Phase factor. - @raise [Invalid_argument] if the spin-determinant is [None]. + @raise Invalid_argument if the spin-determinant is [None]. *) val bitstring : t -> Z.t (** Bit string. - @raise [Invalid_argument] if the spin-determinant is [None]. + @raise Invalid_argument if the spin-determinant is [None]. *) val is_none : t -> bool