mirror of
https://github.com/aljazceru/turso.git
synced 2025-12-24 03:34:18 +01:00
105 lines
3.6 KiB
Tcl
Executable File
105 lines
3.6 KiB
Tcl
Executable File
#!/usr/bin/env tclsh
|
|
|
|
set testdir [file dirname $argv0]
|
|
source $testdir/tester.tcl
|
|
|
|
# SIMPLE SMOKE TESTS THAT DO NOT DEPEND ON SPECIFIC DATABASE ROWS
|
|
|
|
do_execsql_test collate_nocase {
|
|
SELECT 'hat' == 'hAt' COLLATE NOCASE;
|
|
} {1}
|
|
|
|
do_execsql_test collate_binary_1 {
|
|
SELECT 'hat' == 'hAt' COLLATE BINARY;
|
|
} {0}
|
|
|
|
do_execsql_test collate_binary_2 {
|
|
SELECT 'hat' == 'hat' COLLATE BINARY;
|
|
} {1}
|
|
|
|
do_execsql_test collate_rtrim_1 {
|
|
SELECT 'hat' == 'hAt ' COLLATE RTRIM;
|
|
} {0}
|
|
|
|
do_execsql_test collate_rtrim_2 {
|
|
SELECT 'hat' == 'hat ' COLLATE RTRIM;
|
|
} {1}
|
|
|
|
do_execsql_test collate_rtrim_3 {
|
|
SELECT 'hat' == ' hAt ' COLLATE RTRIM;
|
|
} {0}
|
|
|
|
do_execsql_test collate_rtrim_4 {
|
|
SELECT 'hat' == ' hat ' COLLATE RTRIM;
|
|
} {0}
|
|
|
|
do_execsql_test collate_left_precedence {
|
|
SELECT 'hat' COLLATE BINARY == 'hAt' COLLATE NOCASE;
|
|
} {0}
|
|
|
|
do_execsql_test collate_left_precedence_2 {
|
|
SELECT 'hat' COLLATE NOCASE == 'hAt' COLLATE BINARY;
|
|
} {1}
|
|
|
|
do_execsql_test_in_memory_any_error collate_unique_constraint {
|
|
CREATE TABLE t (a TEXT COLLATE NOCASE PRIMARY KEY);
|
|
INSERT INTO t VALUES ('lol'), ('LOL'), ('lOl');
|
|
}
|
|
|
|
do_execsql_test_in_memory_any_error collate_unique_constraint {
|
|
CREATE TABLE t (a TEXT COLLATE NOCASE PRIMARY KEY);
|
|
INSERT INTO t VALUES ('lol'), ('LOL'), ('lOl');
|
|
}
|
|
|
|
do_execsql_test_on_specific_db {:memory:} collate_aggregation_default_binary {
|
|
create table fruits(name collate binary);
|
|
insert into fruits(name) values ('Apple') ,('banana') ,('CHERRY');
|
|
select max(name) from fruits;
|
|
} {banana}
|
|
|
|
do_execsql_test_on_specific_db {:memory:} collate_aggregation_default_nocase {
|
|
create table fruits(name collate nocase);
|
|
insert into fruits(name) values ('Apple') ,('banana') ,('CHERRY');
|
|
select max(name) from fruits;
|
|
} {CHERRY}
|
|
|
|
do_execsql_test_on_specific_db {:memory:} collate_aggregation_explicit_binary {
|
|
create table fruits(name collate nocase);
|
|
insert into fruits(name) values ('Apple') ,('banana') ,('CHERRY');
|
|
select max(name collate binary) from fruits;
|
|
} {banana}
|
|
|
|
do_execsql_test_on_specific_db {:memory:} collate_aggregation_explicit_nocase {
|
|
create table fruits(name collate binary);
|
|
insert into fruits(name) values ('Apple') ,('banana') ,('CHERRY');
|
|
select max(name collate nocase) from fruits;
|
|
} {CHERRY}
|
|
|
|
do_execsql_test_on_specific_db {:memory:} collate_grouped_aggregation_default_binary {
|
|
create table fruits(name collate binary, category text);
|
|
insert into fruits(name, category) values ('Apple', 'A'), ('banana', 'A'), ('CHERRY', 'B'), ('blueberry', 'B');
|
|
select max(name) from fruits group by category;
|
|
} {banana
|
|
blueberry}
|
|
|
|
do_execsql_test_on_specific_db {:memory:} collate_grouped_aggregation_default_nocase {
|
|
create table fruits(name collate nocase, category text);
|
|
insert into fruits(name, category) values ('Apple', 'A'), ('banana', 'A'), ('CHERRY', 'B'), ('blueberry', 'B');
|
|
select max(name) from fruits group by category;
|
|
} {banana
|
|
CHERRY}
|
|
|
|
do_execsql_test_on_specific_db {:memory:} collate_grouped_aggregation_explicit_binary {
|
|
create table fruits(name collate nocase, category text);
|
|
insert into fruits(name, category) values ('Apple', 'A'), ('banana', 'A'), ('CHERRY', 'B'), ('blueberry', 'B');
|
|
select max(name collate binary) from fruits group by category;
|
|
} {banana
|
|
blueberry}
|
|
|
|
do_execsql_test_on_specific_db {:memory:} collate_groupped_aggregation_explicit_nocase {
|
|
create table fruits(name collate binary, category text);
|
|
insert into fruits(name, category) values ('Apple', 'A'), ('banana', 'A'), ('CHERRY', 'B'), ('blueberry', 'B');
|
|
select max(name collate nocase) from fruits group by category;
|
|
} {banana
|
|
CHERRY}
|