-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_simple_join.bats
35 lines (26 loc) · 1.01 KB
/
test_simple_join.bats
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
#!/usr/bin/env bats
setup_file() {
run make
}
@test "Simple JOIN on column equality" {
run ./build/squel "SELECT col1,col3,int FROM './test/data/small.csv' JOIN './test/data/small2.csv' ON col3=int"
[[ $"${lines[1]}" == "MAMA;32;32" ]]
[[ $"${lines[2]}" == "UU;999;999" ]]
[[ $"${lines[3]}" == "" ]]
}
@test "Simple JOIN on column unequality" {
run ./build/squel "SELECT col1,col3,int FROM './test/data/small.csv' JOIN './test/data/small2.csv' ON col3>int"
[[ $"${lines[1]}" == "UU;999;32" ]]
[[ $"${lines[2]}" == "UU;100;32" ]]
[[ $"${lines[3]}" == "UU;300;32" ]]
[[ $"${lines[4]}" == "DEFG;400;32" ]]
[[ $"${lines[5]}" == "" ]]
}
@test "Simple JOIN on column unequality using aliases" {
run ./build/squel "SELECT a.col3 FROM './test/data/small.csv' AS a JOIN './test/data/small2.csv' AS b ON a.col3>b.int"
[[ $"${lines[1]}" == "999" ]]
[[ $"${lines[2]}" == "100" ]]
[[ $"${lines[3]}" == "300" ]]
[[ $"${lines[4]}" == "400" ]]
[[ $"${lines[5]}" == "" ]]
}