コード例 #1
0
ファイル: MemberTest.java プロジェクト: rusher/dynCol
 @Test
 public void intOneByteArrayTest() throws SQLException {
   byte[] oneByteValue = new byte[1];
   oneByteValue[0] = 0x01;
   Member member = new Member(DynamicType.INT, "name", oneByteValue);
   Assert.assertEquals(1, member.getInt());
 }
コード例 #2
0
ファイル: MemberTest.java プロジェクト: rusher/dynCol
 @Test
 public void intUnsignedFourByteArrayTest() throws SQLException {
   byte[] oneByteValue = new byte[4];
   oneByteValue[0] = (byte) 0x00;
   oneByteValue[1] = (byte) 0x00;
   oneByteValue[2] = (byte) 0x00;
   oneByteValue[3] = (byte) 0x80;
   Member member = new Member(DynamicType.UINT, "name", oneByteValue);
   Assert.assertEquals(Integer.MAX_VALUE + 1L, member.getUInt());
 }
コード例 #3
0
ファイル: MemberTest.java プロジェクト: rusher/dynCol
 @Test
 public void intFourByteArrayNegativeTest() throws SQLException {
   byte[] oneByteValue = new byte[4];
   oneByteValue[0] = (byte) 0x00;
   oneByteValue[1] = (byte) 0x00;
   oneByteValue[2] = (byte) 0x00;
   oneByteValue[3] = (byte) 0x80;
   Member member = new Member(DynamicType.INT, "name", oneByteValue);
   Assert.assertEquals(Integer.MIN_VALUE, member.getInt());
 }
コード例 #4
0
ファイル: MemberTest.java プロジェクト: rusher/dynCol
 @Test(expected = SQLException.class)
 public void intFromLongNotValidTest() throws SQLException {
   byte[] oneByteValue = new byte[8];
   oneByteValue[0] = 0x00;
   oneByteValue[1] = 0x00;
   oneByteValue[2] = 0x00;
   oneByteValue[3] = 0x00;
   oneByteValue[4] = 0x00;
   oneByteValue[5] = 0x00;
   oneByteValue[6] = 0x00;
   oneByteValue[7] = 0x01;
   Member member = new Member(DynamicType.DOUBLE, "name", oneByteValue);
   member.getInt();
 }
コード例 #5
0
ファイル: MemberTest.java プロジェクト: rusher/dynCol
 @Test
 public void intFromLongValidTest() throws SQLException {
   byte[] oneByteValue = new byte[8];
   oneByteValue[0] = 0x00;
   oneByteValue[1] = 0x00;
   oneByteValue[2] = 0x00;
   oneByteValue[3] = 0x01;
   oneByteValue[4] = 0x00;
   oneByteValue[5] = 0x00;
   oneByteValue[6] = 0x00;
   oneByteValue[7] = 0x00;
   Member member = new Member(DynamicType.DOUBLE, "name", oneByteValue);
   Assert.assertEquals(16777216, member.getInt());
 }
コード例 #6
0
ファイル: MemberTest.java プロジェクト: rusher/dynCol
 @Test(expected = SQLException.class)
 public void intTimeExceptionTest() throws SQLException {
   Member member = new Member(DynamicType.TIME, "name", new byte[4]);
   member.getInt();
 }
コード例 #7
0
ファイル: MemberTest.java プロジェクト: rusher/dynCol
 @Test(expected = SQLException.class)
 public void intStringMoreThanIntArrayTest() throws SQLException {
   byte[] oneByteValue = "167772168999999".getBytes();
   Member member = new Member(DynamicType.STRING, "name", oneByteValue);
   member.getInt();
 }
コード例 #8
0
ファイル: MemberTest.java プロジェクト: rusher/dynCol
 @Test
 public void intStringTest() throws SQLException {
   byte[] oneByteValue = "16777216".getBytes();
   Member member = new Member(DynamicType.STRING, "name", oneByteValue);
   Assert.assertEquals(16777216, member.getInt());
 }