Fix some unit tests after fundamental changes that made them invalid

Sat, 22 Oct 2022 18:12:49 +0300

author
Tuomo Valkonen <tuomov@iki.fi>
date
Sat, 22 Oct 2022 18:12:49 +0300
changeset 1
df3901ec2f5d
parent 0
9f27689eb130
child 2
ac84e995e119

Fix some unit tests after fundamental changes that made them invalid

src/fe_model/p2_local_model.rs file | annotate | diff | comparison | revisions
src/iterate.rs file | annotate | diff | comparison | revisions
--- a/src/fe_model/p2_local_model.rs	Sat Oct 22 13:47:15 2022 +0300
+++ b/src/fe_model/p2_local_model.rs	Sat Oct 22 18:12:49 2022 +0300
@@ -376,7 +376,6 @@
                          self.minimise_edge(&x2, &x3),
                          self.minimise_edge(&x3, &x0)];
 
-        
         for edge in more_edge {
             if edge.1 < min_edge.1 {
                 min_edge = edge;
@@ -433,7 +432,7 @@
         let domain = Simplex(vertices);
         // A simple quadratic function for which the approximation is exact on reals,
         // and appears exact on f64 as well.
-        let f = |&Loc([x, y]) : &Loc<f64, 2>| x*x + x*y + x - y + 1.0;
+        let f = |&Loc([x, y]) : &Loc<f64, 2>| - (x*x + x*y + x - 2.0 * y + 1.0);
         let model = domain.p2_model(f);
         let xs = [Loc([0.5, 0.5]), Loc([0.25, 0.25])];
 
@@ -441,6 +440,6 @@
             assert_eq!(model.value(&x), f(&x));
         }
 
-        assert_eq!(model.minimise(&domain), (Loc([1.0, 1.0]), 3.0));
+        assert_eq!(model.minimise(&domain), (Loc([1.0, 0.0]), -3.0));
     }
 }
--- a/src/iterate.rs	Sat Oct 22 13:47:15 2022 +0300
+++ b/src/iterate.rs	Sat Oct 22 18:12:49 2022 +0300
@@ -908,8 +908,9 @@
                           .iter()
                           .map(|LogItem{ data : v, iter : _ }| v.clone())
                           .collect::<Vec<int>>(),
-                      (0..10).step_by(3)
-                             .map(|i| (2 as int).pow(i+1))
+                      (1..10).map(|i| (2 as int).pow(i))
+                             .skip(2)
+                             .step_by(3)
                              .collect::<Vec<int>>())
         }
     }

mercurial