-
Notifications
You must be signed in to change notification settings - Fork 77
Expand file tree
/
Copy pathtestSnowflake.java
More file actions
37 lines (33 loc) · 1.49 KB
/
Copy pathtestSnowflake.java
File metadata and controls
37 lines (33 loc) · 1.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package gettablecolumn;
import demos.gettablecolumns.TGetTableColumn;
import gudusoft.gsqlparser.EDbVendor;
import junit.framework.TestCase;
public class testSnowflake extends TestCase {
static void doTest(String inputQuery, String desireResult){
TGetTableColumn getTableColumn = new TGetTableColumn(EDbVendor.dbvsnowflake);
getTableColumn.isConsole = false;
getTableColumn.showTableEffect = false;
getTableColumn.showColumnLocation = false;
getTableColumn.showTreeStructure = false;
getTableColumn.showDatatype = true;
getTableColumn.runText(inputQuery);
// System.out.println(getTableColumn.outList.toString().trim());
assertTrue(getTableColumn.outList.toString().trim().equalsIgnoreCase(desireResult));
}
public static void testCreateFunction() {
doTest("create function profit()\n" +
" returns numeric(11, 2)\n" +
" as\n" +
" $$\n" +
" select sum((retail_price - wholesale_price) * number_sold) from purchases\n" +
" $$\n" +
" ;",
"Tables:\n" +
"purchases\n" +
"\n" +
"Fields:\n" +
"purchases.number_sold\n" +
"purchases.retail_price\n" +
"purchases.wholesale_price");
}
}