/**
 * END USER LICENSE AGREEMENT (“EULA”)
 *
 * READ THIS AGREEMENT CAREFULLY (date: 9/13/2011):
 * http://www.akiban.com/licensing/20110913
 *
 * BY INSTALLING OR USING ALL OR ANY PORTION OF THE SOFTWARE, YOU ARE ACCEPTING
 * ALL OF THE TERMS AND CONDITIONS OF THIS AGREEMENT. YOU AGREE THAT THIS
 * AGREEMENT IS ENFORCEABLE LIKE ANY WRITTEN AGREEMENT SIGNED BY YOU.
 *
 * IF YOU HAVE PAID A LICENSE FEE FOR USE OF THE SOFTWARE AND DO NOT AGREE TO
 * THESE TERMS, YOU MAY RETURN THE SOFTWARE FOR A FULL REFUND PROVIDED YOU (A) DO
 * NOT USE THE SOFTWARE AND (B) RETURN THE SOFTWARE WITHIN THIRTY (30) DAYS OF
 * YOUR INITIAL PURCHASE.
 *
 * IF YOU WISH TO USE THE SOFTWARE AS AN EMPLOYEE, CONTRACTOR, OR AGENT OF A
 * CORPORATION, PARTNERSHIP OR SIMILAR ENTITY, THEN YOU MUST BE AUTHORIZED TO SIGN
 * FOR AND BIND THE ENTITY IN ORDER TO ACCEPT THE TERMS OF THIS AGREEMENT. THE
 * LICENSES GRANTED UNDER THIS AGREEMENT ARE EXPRESSLY CONDITIONED UPON ACCEPTANCE
 * BY SUCH AUTHORIZED PERSONNEL.
 *
 * IF YOU HAVE ENTERED INTO A SEPARATE WRITTEN LICENSE AGREEMENT WITH AKIBAN FOR
 * USE OF THE SOFTWARE, THE TERMS AND CONDITIONS OF SUCH OTHER AGREEMENT SHALL
 * PREVAIL OVER ANY CONFLICTING TERMS OR CONDITIONS IN THIS AGREEMENT.
 */

package com.akiban.sql.parser;

import com.akiban.sql.StandardException;
import org.junit.Test;

public class RowCtorTest
{
    // no parexception means "pass"
    

    @Test
    public void regularCase() throws StandardException
    {
        // smoke test
        // make sure it didn't break things that are working
        doTest("SELECT 3 IN (4,5,6)");
        
        
    }
    
    @Test
    public void columnTest() throws StandardException
    {
        doTest("SELECT (2, 3, 4) IN ((5, 6, 7), (8, 9, 10))");
    }

    @Test
    public void mistmatchColumnTest() throws StandardException
    {
        // This should still pass
        // It's not the parser's job to check the number of columns
        // should be handle in InExpression
        doTest("SELECT (2, 3, 4) IN (4, 5, 6)");
    }

    @Test
    public void nestedRows() throws StandardException
    {
        doTest("SELECT ((2, 3), (4, 5)) in ((4, 5), (5, 7))");
    }
    
    @Test
    public void nonNestedRowsWithParens() throws StandardException
    {
        doTest("SELECT (((2)), 3) in ((4, ((5))))");
    }

    static void doTest(String st) throws StandardException
    {
        SQLParser parser = new SQLParser();
        StatementNode node = parser.parseStatement(st);
    }
}



@@ -1456,32 +1456,75 @@
 Exception%0A    %7B%0A
+        System.out.println(%22regularCase%22);%0A
         // smoke
@@ -1525,24 +1525,24 @@
  smoke test%0A
-
         // m
@@ -1720,32 +1720,74 @@
 Exception%0A    %7B%0A
+        System.out.println(%22columnTest%22);%0A
         doTest(%22
@@ -1911,32 +1911,78 @@
 Exception%0A    %7B%0A
+        System.out.println(%22mismatchColumn%22);%0A
         // This 
@@ -2107,24 +2107,224 @@
 nExpression%0A
+        //%0A        // Could add a field called 'depth' to RowConstructorNode%0A        // so some checking could be done here%0A        // (ie., the left list MUST be one level deeper than the right one)%0A
         doTe
@@ -2429,32 +2429,75 @@
 Exception%0A    %7B%0A
+        System.out.println(%22nested rows%22);%0A
         doTest(%22
@@ -2545,29 +2545,25 @@
 ))%22);%0A    %7D%0A
-    
 %0A
+
     @Test%0A  
@@ -2625,32 +2625,79 @@
 Exception%0A    %7B%0A
+        System.out.println(%22non nested rows%22);%0A
         doTest(%22
@@ -2707,18 +2707,10 @@
 ECT 
-(((2)), 3)
+1 
  in 
@@ -2901,14 +2901,70 @@
 t);%0A
+        %0A        System.out.println(%22%5Cn%5Cn----------%5Cn%22);%0A
     %7D%0A
+
 %7D%0A%0A
-%0A

clean up