mirror of
https://github.com/aljazceru/turso.git
synced 2025-12-18 09:04:19 +01:00
added delete operations to blobs in memory and write tests
This commit is contained in:
@@ -20,7 +20,7 @@ def stub_memory_test(
|
|||||||
# zero_blob_size = 1024 **2
|
# zero_blob_size = 1024 **2
|
||||||
zero_blob = "0" * blob_size * 2
|
zero_blob = "0" * blob_size * 2
|
||||||
# vals = 100
|
# vals = 100
|
||||||
big_stmt = ["CREATE TABLE temp (t1 BLOB, t2 INTEGER);"]
|
big_stmt = ["CREATE TABLE temp (t1 BLOB, t2 INTEGER);", "CREATE INDEX temp_index ON temp(t1);"]
|
||||||
big_stmt = big_stmt + [
|
big_stmt = big_stmt + [
|
||||||
f"INSERT INTO temp (t1) VALUES (zeroblob({blob_size}));"
|
f"INSERT INTO temp (t1) VALUES (zeroblob({blob_size}));"
|
||||||
if i % 2 == 0 and blobs
|
if i % 2 == 0 and blobs
|
||||||
@@ -39,6 +39,10 @@ def stub_memory_test(
|
|||||||
big_stmt.append("SELECT count(*) FROM temp;")
|
big_stmt.append("SELECT count(*) FROM temp;")
|
||||||
expected.append(str(vals * 2))
|
expected.append(str(vals * 2))
|
||||||
|
|
||||||
|
big_stmt.append("DELETE FROM temp;")
|
||||||
|
big_stmt.append("SELECT count(*) FROM temp;")
|
||||||
|
expected.append(str(0))
|
||||||
|
|
||||||
big_stmt = "".join(big_stmt)
|
big_stmt = "".join(big_stmt)
|
||||||
expected = "\n".join(expected)
|
expected = "\n".join(expected)
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ class InsertTest(BaseModel):
|
|||||||
|
|
||||||
def run(self, limbo: TestLimboShell):
|
def run(self, limbo: TestLimboShell):
|
||||||
zero_blob = "0" * self.blob_size * 2
|
zero_blob = "0" * self.blob_size * 2
|
||||||
big_stmt = [self.db_schema]
|
big_stmt = [self.db_schema, "CREATE INDEX test_index ON test(t1);"]
|
||||||
big_stmt = big_stmt + [
|
big_stmt = big_stmt + [
|
||||||
f"INSERT INTO test (t1) VALUES (zeroblob({self.blob_size}));"
|
f"INSERT INTO test (t1) VALUES (zeroblob({self.blob_size}));"
|
||||||
if i % 2 == 0 and self.has_blob
|
if i % 2 == 0 and self.has_blob
|
||||||
@@ -37,6 +37,10 @@ class InsertTest(BaseModel):
|
|||||||
|
|
||||||
big_stmt.append("SELECT count(*) FROM test;")
|
big_stmt.append("SELECT count(*) FROM test;")
|
||||||
expected.append(str(self.vals * 2))
|
expected.append(str(self.vals * 2))
|
||||||
|
|
||||||
|
big_stmt.append("DELETE FROM temp;")
|
||||||
|
big_stmt.append("SELECT count(*) FROM temp;")
|
||||||
|
expected.append(str(0))
|
||||||
|
|
||||||
big_stmt = "".join(big_stmt)
|
big_stmt = "".join(big_stmt)
|
||||||
expected = "\n".join(expected)
|
expected = "\n".join(expected)
|
||||||
|
|||||||
Reference in New Issue
Block a user