1 21 package com.db4o.db4ounit.common.soda.arrays.typed; 22 import com.db4o.query.*; 23 24 25 public class STArrIntegerTTestCase extends com.db4o.db4ounit.common.soda.util.SodaBaseTestCase{ 26 27 public int[] intArr; 28 29 public STArrIntegerTTestCase(){ 30 } 31 32 public STArrIntegerTTestCase(int[] arr){ 33 intArr = arr; 34 } 35 36 public Object [] createData() { 37 return new Object []{ 38 new STArrIntegerTTestCase(), 39 new STArrIntegerTTestCase(new int[0]), 40 new STArrIntegerTTestCase(new int[] {0, 0}), 41 new STArrIntegerTTestCase(new int[] {1, 17, Integer.MAX_VALUE - 1}), 42 new STArrIntegerTTestCase(new int[] {3, 17, 25, Integer.MAX_VALUE - 2}) 43 }; 44 } 45 46 public void testDefaultContainsOne(){ 47 Query q = newQuery(); 48 49 q.constrain(new STArrIntegerTTestCase(new int[] {17})); 50 expect(q, new int[] {3, 4}); 51 } 52 53 public void testDefaultContainsTwo(){ 54 Query q = newQuery(); 55 56 q.constrain(new STArrIntegerTTestCase(new int[] {17, 25})); 57 expect(q, new int[] {4}); 58 } 59 60 public void testDescendOne(){ 61 Query q = newQuery(); 62 63 q.constrain(STArrIntegerTTestCase.class); 64 q.descend("intArr").constrain(new Integer (17)); 65 expect(q, new int[] {3, 4}); 66 } 67 68 public void testDescendTwo(){ 69 Query q = newQuery(); 70 71 q.constrain(STArrIntegerTTestCase.class); 72 Query qElements = q.descend("intArr"); 73 qElements.constrain(new Integer (17)); 74 qElements.constrain(new Integer (25)); 75 expect(q, new int[] {4}); 76 } 77 78 public void testDescendSmaller(){ 79 Query q = newQuery(); 80 81 q.constrain(STArrIntegerTTestCase.class); 82 Query qElements = q.descend("intArr"); 83 qElements.constrain(new Integer (3)).smaller(); 84 expect(q, new int[] {2, 3}); 85 } 86 87 public void testDescendNotSmaller(){ 88 Query q = newQuery(); 89 90 q.constrain(STArrIntegerTTestCase.class); 91 Query qElements = q.descend("intArr"); 92 qElements.constrain(new Integer (3)).smaller(); 93 expect(q, new int[] {2, 3}); 94 } 95 96 97 98 } 99 100 | Popular Tags |