db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rhille...@apache.org
Subject svn commit: r670660 - in /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang: AnsiSignatures.java AnsiSignaturesTest.java
Date Mon, 23 Jun 2008 15:50:41 GMT
Author: rhillegas
Date: Mon Jun 23 08:50:41 2008
New Revision: 670660

URL: http://svn.apache.org/viewvc?rev=670660&view=rev
Log:
DERBY-3652: Adding some tests for BINARY, VARBINARY, and LONGVARBINARY parameter and return
types.

Modified:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/AnsiSignatures.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/AnsiSignaturesTest.java

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/AnsiSignatures.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/AnsiSignatures.java?rev=670660&r1=670659&r2=670660&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/AnsiSignatures.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/AnsiSignatures.java
Mon Jun 23 08:50:41 2008
@@ -643,4 +643,82 @@
          )
     { return c; }
 
+    //
+    // BINARY
+    //
+    
+    // legal resolutions
+
+    public  static  byte[]  binary_bytes_bytes( byte[] a ) { return a; }
+    public  static  byte[]  binary_bytes_bytes( byte a ) { return new byte[] { (byte) -1
}; }
+    public  static  byte[]  binary_bytes_bytes( int a ) { return new byte[] { (byte) -1 };
}
+    public  static  byte[]  binary_bytes_bytes( long a ) { return new byte[] { (byte) -1
}; }
+    public  static  byte[]  binary_bytes_bytes( float a ) { return new byte[] { (byte) -1
}; }
+    public  static  byte[]  binary_bytes_bytes( double a ) { return new byte[] { (byte) -1
}; }
+    public  static  byte[]  binary_bytes_bytes( Byte a ) { return new byte[] { (byte) -1
}; }
+    public  static  byte[]  binary_bytes_bytes( Short a ) { return new byte[] { (byte) -1
}; }
+    public  static  byte[]  binary_bytes_bytes( Long a ) { return new byte[] { (byte) -1
}; }
+    public  static  byte[]  binary_bytes_bytes( Float a ) { return new byte[] { (byte) -1
}; }
+    public  static  byte[]  binary_bytes_bytes( Double a ) { return new byte[] { (byte) -1
}; }
+    public  static  byte[]  binary_bytes_bytes( BigDecimal a ) { return new byte[] { (byte)
-1 }; }
+    public  static  byte[]  binary_bytes_bytes( String a ) { return new byte[] { (byte) -1
}; }
+    public  static  byte[]  binary_bytes_bytes( Object a ) { return new byte[] { (byte) -1
}; }
+
+    public  static  byte[]  binary_bytes_int( int a ) { return new byte[] { (byte) a }; }
+
+    // bad return type
+    public  static  int  binary_badreturn_bytes_bytes( byte[] a ) { return -1; }
+    
+    //
+    // VARBINARY
+    //
+    
+    // legal resolutions
+
+    public  static  byte[]  varbinary_bytes_bytes( byte[] a ) { return a; }
+    public  static  byte[]  varbinary_bytes_bytes( byte a ) { return new byte[] { (byte)
-1 }; }
+    public  static  byte[]  varbinary_bytes_bytes( int a ) { return new byte[] { (byte) -1
}; }
+    public  static  byte[]  varbinary_bytes_bytes( long a ) { return new byte[] { (byte)
-1 }; }
+    public  static  byte[]  varbinary_bytes_bytes( float a ) { return new byte[] { (byte)
-1 }; }
+    public  static  byte[]  varbinary_bytes_bytes( double a ) { return new byte[] { (byte)
-1 }; }
+    public  static  byte[]  varbinary_bytes_bytes( Byte a ) { return new byte[] { (byte)
-1 }; }
+    public  static  byte[]  varbinary_bytes_bytes( Short a ) { return new byte[] { (byte)
-1 }; }
+    public  static  byte[]  varbinary_bytes_bytes( Long a ) { return new byte[] { (byte)
-1 }; }
+    public  static  byte[]  varbinary_bytes_bytes( Float a ) { return new byte[] { (byte)
-1 }; }
+    public  static  byte[]  varbinary_bytes_bytes( Double a ) { return new byte[] { (byte)
-1 }; }
+    public  static  byte[]  varbinary_bytes_bytes( BigDecimal a ) { return new byte[] { (byte)
-1 }; }
+    public  static  byte[]  varbinary_bytes_bytes( String a ) { return new byte[] { (byte)
-1 }; }
+    public  static  byte[]  varbinary_bytes_bytes( Object a ) { return new byte[] { (byte)
-1 }; }
+
+    public  static  byte[]  varbinary_bytes_int( int a ) { return new byte[] { (byte) a };
}
+
+    // bad return type
+    public  static  int  varbinary_badreturn_bytes_bytes( byte[] a ) { return -1; }
+    
+
+    //
+    // LONGVARBINARY
+    //
+    
+    // legal resolutions
+
+    public  static  byte[]  longvarbinary_bytes_bytes( byte[] a ) { return a; }
+    public  static  byte[]  longvarbinary_bytes_bytes( byte a ) { return new byte[] { (byte)
-1 }; }
+    public  static  byte[]  longvarbinary_bytes_bytes( int a ) { return new byte[] { (byte)
-1 }; }
+    public  static  byte[]  longvarbinary_bytes_bytes( long a ) { return new byte[] { (byte)
-1 }; }
+    public  static  byte[]  longvarbinary_bytes_bytes( float a ) { return new byte[] { (byte)
-1 }; }
+    public  static  byte[]  longvarbinary_bytes_bytes( double a ) { return new byte[] { (byte)
-1 }; }
+    public  static  byte[]  longvarbinary_bytes_bytes( Byte a ) { return new byte[] { (byte)
-1 }; }
+    public  static  byte[]  longvarbinary_bytes_bytes( Short a ) { return new byte[] { (byte)
-1 }; }
+    public  static  byte[]  longvarbinary_bytes_bytes( Long a ) { return new byte[] { (byte)
-1 }; }
+    public  static  byte[]  longvarbinary_bytes_bytes( Float a ) { return new byte[] { (byte)
-1 }; }
+    public  static  byte[]  longvarbinary_bytes_bytes( Double a ) { return new byte[] { (byte)
-1 }; }
+    public  static  byte[]  longvarbinary_bytes_bytes( BigDecimal a ) { return new byte[]
{ (byte) -1 }; }
+    public  static  byte[]  longvarbinary_bytes_bytes( String a ) { return new byte[] { (byte)
-1 }; }
+    public  static  byte[]  longvarbinary_bytes_bytes( Object a ) { return new byte[] { (byte)
-1 }; }
+
+    public  static  byte[]  longvarbinary_bytes_int( int a ) { return new byte[] { (byte)
a }; }
+
+    // bad return type
+    public  static  int  longvarbinary_badreturn_bytes_bytes( byte[] a ) { return -1; }
 }

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/AnsiSignaturesTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/AnsiSignaturesTest.java?rev=670660&r1=670659&r2=670660&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/AnsiSignaturesTest.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/AnsiSignaturesTest.java
Mon Jun 23 08:50:41 2008
@@ -272,6 +272,48 @@
              );
     }
 
+    public  void    test_binary_bytes_bytes()
+        throws Exception
+    {
+        declareAndRunFunction
+            ( "binary_bytes_bytes", "char( 2 ) for bit data", new String[] { "char( 2 ) for
bit data" }, "X'a1b2'", "a1b2" );
+    }
+
+    public  void    test_binary_bytes_int()
+        throws Exception
+    {
+        declareAndRunFunction
+            ( "binary_bytes_int", "char( 1 ) for bit data", new String[] { "integer" }, "3",
"03" );
+    }
+
+    public  void    test_varbinary_bytes_bytes()
+        throws Exception
+    {
+        declareAndRunFunction
+            ( "varbinary_bytes_bytes", "varchar( 2 ) for bit data", new String[] { "varchar(
2 ) for bit data" }, "X'a1b2'", "a1b2" );
+    }
+
+    public  void    test_varbinary_bytes_int()
+        throws Exception
+    {
+        declareAndRunFunction
+            ( "varbinary_bytes_int", "char( 1 ) for bit data", new String[] { "integer" },
"3", "03" );
+    }
+
+    public  void    test_longvarbinary_bytes_bytes()
+        throws Exception
+    {
+        declareAndRunFunction
+            ( "longvarbinary_bytes_bytes", "long varchar for bit data", new String[] { "varchar(2)
for bit data" }, "X'a1b2'", "a1b2" );
+    }
+
+    public  void    test_longvarbinary_bytes_int()
+        throws Exception
+    {
+        declareAndRunFunction
+            ( "longvarbinary_bytes_int", "long varchar for bit data", new String[] { "integer"
}, "3", "03" );
+    }
+
     ///////////////////////////////////////////////////////////////////////////////////
     //
     // SHOULD NOT RESOLVE
@@ -338,6 +380,27 @@
             ( "double_badreturn_byte_double", "double", new String[] { "double" }, "3.0",
"3.0", TRIED_ALL_COMBINATIONS );
     }
 
+     public  void    test_binary_badreturn_bytes_bytes()
+        throws Exception
+    {
+        declareAndFailFunction
+            ( "binary_badreturn_bytes_bytes", "char( 2 ) for bit data", new String[] { "char(
2 ) for bit data" }, "X'a1b2'", "a1b2", TRIED_ALL_COMBINATIONS );
+    }
+
+     public  void    test_varbinary_badreturn_bytes_bytes()
+        throws Exception
+    {
+        declareAndFailFunction
+            ( "varbinary_badreturn_bytes_bytes", "varchar( 2 ) for bit data", new String[]
{ "varchar( 2 ) for bit data" }, "X'a1b2'", "a1b2", TRIED_ALL_COMBINATIONS );
+    }
+
+     public  void    test_longvarbinary_badreturn_bytes_bytes()
+        throws Exception
+    {
+        declareAndFailFunction
+            ( "longvarbinary_badreturn_bytes_bytes", "long varchar for bit data", new String[]
{ "char( 2 ) for bit data" }, "X'a1b2'", "a1b2", TRIED_ALL_COMBINATIONS );
+    }
+
     ///////////////////////////////////////////////////////////////////////////////////
     //
     // AMBIGUOUS METHODS



Mime
View raw message