()
| 53 | } |
| 54 | |
| 55 | @Test |
| 56 | public void testOperator() throws ExecException { |
| 57 | // int TRIALS = 10; |
| 58 | byte[] types = { DataType.BAG, DataType.BOOLEAN, DataType.BYTEARRAY, DataType.CHARARRAY, |
| 59 | DataType.DOUBLE, DataType.FLOAT, DataType.INTEGER, DataType.LONG, DataType.BIGDECIMAL, |
| 60 | DataType.DATETIME, DataType.MAP, DataType.TUPLE }; |
| 61 | // Map<Byte,String> map = GenRandomData.genTypeToNameMap(); |
| 62 | System.out.println("Testing DIVIDE operator"); |
| 63 | for (byte type : types) { |
| 64 | lt.setResultType(type); |
| 65 | rt.setResultType(type); |
| 66 | op.setLhs(lt); |
| 67 | op.setRhs(rt); |
| 68 | |
| 69 | switch (type) { |
| 70 | case DataType.BAG: |
| 71 | DataBag inpdb1 = GenRandomData.genRandSmallTupDataBag(r, 10, 100); |
| 72 | DataBag inpdb2 = GenRandomData.genRandSmallTupDataBag(r, 10, 100); |
| 73 | lt.setValue(inpdb1); |
| 74 | rt.setValue(inpdb2); |
| 75 | Result resdb = op.getNextDataBag(); |
| 76 | assertEquals(resdb.returnStatus, POStatus.STATUS_ERR); |
| 77 | |
| 78 | // test with null in lhs |
| 79 | lt.setValue(null); |
| 80 | rt.setValue(inpdb2); |
| 81 | resdb = op.getNextDataBag(); |
| 82 | assertEquals(resdb.returnStatus, POStatus.STATUS_ERR); |
| 83 | // test with null in rhs |
| 84 | lt.setValue(inpdb1); |
| 85 | rt.setValue(null); |
| 86 | resdb = op.getNextDataBag(); |
| 87 | assertEquals(resdb.returnStatus, POStatus.STATUS_ERR); |
| 88 | break; |
| 89 | case DataType.BOOLEAN: |
| 90 | Boolean inpb1 = r.nextBoolean(); |
| 91 | Boolean inpb2 = r.nextBoolean(); |
| 92 | lt.setValue(inpb1); |
| 93 | rt.setValue(inpb2); |
| 94 | Result resb = op.getNextBoolean(); |
| 95 | assertEquals(resb.returnStatus, POStatus.STATUS_ERR); |
| 96 | |
| 97 | // test with null in lhs |
| 98 | lt.setValue(null); |
| 99 | rt.setValue(inpb2); |
| 100 | resb = op.getNextBoolean(); |
| 101 | assertEquals(resb.returnStatus, POStatus.STATUS_ERR); |
| 102 | // test with null in rhs |
| 103 | lt.setValue(inpb1); |
| 104 | rt.setValue(null); |
| 105 | resb = op.getNextBoolean(); |
| 106 | assertEquals(resb.returnStatus, POStatus.STATUS_ERR); |
| 107 | break; |
| 108 | case DataType.BYTEARRAY: { |
| 109 | DataByteArray inpba1 = GenRandomData.genRandDBA(r); |
| 110 | DataByteArray inpba2 = GenRandomData.genRandDBA(r); |
| 111 | lt.setValue(inpba1); |
| 112 | rt.setValue(inpba2); |
nothing calls this directly
no test coverage detected