1 21 package com.db4o.db4ounit.jre11.soda.wrapper.typed; 22 import com.db4o.query.*; 23 24 25 public class STDoubleWTTestCase extends com.db4o.db4ounit.common.soda.util.SodaBaseTestCase{ 26 27 public Double i_double; 28 29 public STDoubleWTTestCase(){ 30 } 31 32 private STDoubleWTTestCase(double a_double){ 33 i_double = new Double (a_double); 34 } 35 36 public Object [] createData() { 37 return new Object []{ 38 new STDoubleWTTestCase(0), 39 new STDoubleWTTestCase(0), 40 new STDoubleWTTestCase(1.01), 41 new STDoubleWTTestCase(99.99), 42 new STDoubleWTTestCase(909.00) 43 }; 44 } 45 46 public void testEquals(){ 47 Query q = newQuery(); 48 q.constrain(new STDoubleWTTestCase(0)); 49 50 q.descend("i_double").constrain(new Double (0)); 53 54 expect(q, new int[] {0, 1}); 55 } 56 57 public void testGreater(){ 58 Query q = newQuery(); 59 q.constrain(new STDoubleWTTestCase(1)); 60 q.descend("i_double").constraints().greater(); 61 62 expect(q, new int[] {2, 3, 4}); 63 } 64 65 public void testSmaller(){ 66 Query q = newQuery(); 67 q.constrain(new STDoubleWTTestCase(1)); 68 q.descend("i_double").constraints().smaller(); 69 70 expect(q, new int[] {0, 1}); 71 } 72 73 public void testGreaterOrEqual(){ 74 Query q = newQuery(); 75 q.constrain(_array[2]); 76 q.descend("i_double").constraints().greater().equal(); 77 78 expect(q, new int[] {2, 3, 4}); 79 } 80 81 public void testGreaterAndNot(){ 82 Query q = newQuery(); 83 q.constrain(new STDoubleWTTestCase()); 84 Query val = q.descend("i_double"); 85 val.constrain(new Double (0)).greater(); 86 val.constrain(new Double (99.99)).not(); 87 88 expect(q, new int[] {2, 4}); 89 } 90 91 } 92 93 | Popular Tags |