0
0
mirror of https://github.com/tursodatabase/libsql.git synced 2024-12-15 23:48:49 +00:00
ad hoc ad79ef48a2
libsql wal tests (#1408)
* add tests

* add bench
2024-05-24 13:59:17 +00:00

52 lines
1.7 KiB
Plaintext

CREATE TABLE t1(a INTEGER PRIMARY KEY, b);
CREATE INDEX t1b ON t1(b);
INSERT INTO t1(a,b) VALUES(100, 356282677878746339);
INSERT INTO t1(a,b) VALUES(50, 356282677878746339.0);
INSERT INTO t1(a,b) VALUES(0, 356282677878746340);
DELETE FROM t1 WHERE a=50;
PRAGMA integrity_check;
CREATE TABLE t2(a,b);
INSERT INTO t2(a,b) VALUES('b', 1<<58),
('c', (1<<58)+1e-7), ('d', (1<<58)+1);
SELECT a, b, typeof(b), '|' FROM t2 ORDER BY +a;
SELECT x.a || CASE WHEN x.b==y.b THEN '==' ELSE '<>' END || y.a
FROM t2 AS x, t2 AS y
ORDER BY +x.a, +x.b;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1(a INTEGER PRIMARY KEY,b);
CREATE INDEX t1b ON t1(b);
WITH RECURSIVE c(x) AS (VALUES(1) UNION ALL SELECT x+1 FROM c WHERE x<100)
INSERT INTO t1(a,b) SELECT x, 10000000000000004.0 FROM c
WHERE x NOT IN (23,37);
INSERT INTO t1(a,b) VALUES(23,10000000000000005);
INSERT INTO t1(a,b) VALUES(37,10000000000000003);
DELETE FROM t1 WHERE a NOT IN (23,37);
PRAGMA integrity_check;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1(a INTEGER PRIMARY KEY,b);
CREATE INDEX t1b ON t1(b);
WITH RECURSIVE c(x) AS (VALUES(1) UNION ALL SELECT x+1 FROM c WHERE x<20)
INSERT INTO t1(a,b) SELECT x, 100000000000000005.0
FROM c WHERE x NOT IN (3,5,7,11,13,17,19);
INSERT INTO t1(a,b) VALUES(3,100000000000000005);
INSERT INTO t1(a,b) VALUES(5,100000000000000000);
INSERT INTO t1(a,b) VALUES(7,100000000000000008);
INSERT INTO t1(a,b) VALUES(11,100000000000000006);
INSERT INTO t1(a,b) VALUES(13,100000000000000001);
INSERT INTO t1(a,b) VALUES(17,100000000000000004);
INSERT INTO t1(a,b) VALUES(19,100000000000000003);
PRAGMA integrity_check;
SELECT a FROM t1 ORDER BY b;