From 185a240edc57bf0b00020c212c2f3ac025ed3cfe Mon Sep 17 00:00:00 2001
From: Bulat Niatshin <theairvideo@gmail.com>
Date: Fri, 14 Jul 2017 15:57:20 +0300
Subject: [PATCH] sql: bitvec unit test implemented

unit/bitvec.test.c - implemented
This test is an C implementation of
sql-tap/bitvec.test.lua and sql-tap/bitvec.test.tcl

- sql-tap/bitvec.test.lua removed

Closes #2590
---
 test/sql-tap/bitvec.test.lua | 298 -----------------------------------
 test/unit/CMakeLists.txt     |   5 +
 test/unit/sql-bitvec.result  |  28 ++++
 test/unit/sql-bitvec.test.c  | 252 +++++++++++++++++++++++++++++
 4 files changed, 285 insertions(+), 298 deletions(-)
 delete mode 100755 test/sql-tap/bitvec.test.lua
 create mode 100644 test/unit/sql-bitvec.result
 create mode 100644 test/unit/sql-bitvec.test.c

diff --git a/test/sql-tap/bitvec.test.lua b/test/sql-tap/bitvec.test.lua
deleted file mode 100755
index 18c9b17fca..0000000000
--- a/test/sql-tap/bitvec.test.lua
+++ /dev/null
@@ -1,298 +0,0 @@
-#!/usr/bin/env tarantool
-test = require("sqltester")
-test:plan(28)
-
---!./tcltestrunner.lua
--- 2008 February 18
---
--- The author disclaims copyright to this source code.  In place of
--- a legal notice, here is a blessing:
---
---    May you do good and not evil.
---    May you find forgiveness for yourself and forgive others.
---    May you share freely, never taking more than you give.
---
--------------------------------------------------------------------------
---
--- Unit testing of the Bitvec object.
---
--- $Id: bitvec.test,v 1.4 2009/04/01 23:49:04 drh Exp $
---
--- ["set","testdir",[["file","dirname",["argv0"]]]]
--- ["source",[["testdir"],"\/tester.tcl"]]
--- The built-in test logic must be operational in order for
--- this test to work.
-
-local ffi = require("ffi")
-ffi.cdef[[
-int sqlite3BitvecBuiltinTest(int sz, int *aOp);int printf(const char *fmt, ...);
-]]
-
--- Test that sqlite3BitvecBuiltinTest correctly reports errors
--- that are deliberately introduced.
---
-test:do_test(
-    "bitvec-1.0.1",
-    function()
-        local arg = ffi.new("int[20]", {5, 1, 1, 1, 0})
-        return ffi.C.sqlite3BitvecBuiltinTest(400, arg )
-     end, 1)
-
-test:do_test(
-    "bitvec-1.0.2",
-    function()
-        local arg = ffi.new("int[20]", {5, 1, 234, 1, 0})
-        return ffi.C.sqlite3BitvecBuiltinTest(400, arg )
-    end, 234)
-
--- Run test cases that set every bit in vectors of various sizes.
--- for larger cases, this should cycle the bit vector representation
--- from hashing into subbitmaps.  The subbitmaps should start as
--- hashes then change to either subbitmaps or linear maps, depending
--- on their size.
---
-test:do_test(
-    "bitvec-1.1",
-    function()
-        local arg = ffi.new("int[20]", {1, 400, 1, 1, 0})
-        return ffi.C.sqlite3BitvecBuiltinTest(400, arg )
-    end, 0)
-
-test:do_test(
-    "bitvec-1.2",
-    function()
-        local arg = ffi.new("int[20]", {1, 4000, 1, 1, 0})
-        return ffi.C.sqlite3BitvecBuiltinTest(4000, arg )
-    end, 0)
-
-test:do_test(
-    "bitvec-1.3",
-    function()
-        local arg = ffi.new("int[20]", {1, 40000, 1, 1, 0})
-        return ffi.C.sqlite3BitvecBuiltinTest(40000, arg )
-    end, 0)
-
-test:do_test(
-    "bitvec-1.4",
-    function()
-        local arg = ffi.new("int[20]", {1, 400000, 1, 1, 0})
-        return ffi.C.sqlite3BitvecBuiltinTest(400000, arg )
-    end, 0)
-
--- By specifying a larger increments, we spread the load around.
---
-test:do_test(
-    "bitvec-1.5",
-    function()
-        local arg = ffi.new("int[20]", {1, 400, 1, 7, 0})
-        return ffi.C.sqlite3BitvecBuiltinTest(400, arg )
-    end, 0)
-
-test:do_test(
-    "bitvec-1.6",
-    function()
-        local arg = ffi.new("int[20]", {1, 4000, 1, 7, 0})
-        return ffi.C.sqlite3BitvecBuiltinTest(4000, arg )
-    end, 0)
-
-test:do_test(
-    "bitvec-1.7",
-    function()
-        local arg = ffi.new("int[20]", {1, 40000, 1, 7, 0})
-        return ffi.C.sqlite3BitvecBuiltinTest(40000, arg )
-    end, 0)
-
-test:do_test(
-    "bitvec-1.8",
-    function()
-        local arg = ffi.new("int[20]", {1, 400000, 1, 7, 0})
-        return ffi.C.sqlite3BitvecBuiltinTest(400000, arg )
-    end, 0)
-
--- First fill up the bitmap with ones,  then go through and
--- clear all the bits.  This will stress the clearing mechanism.
---
-test:do_test(
-    "bitvec-1.9",
-    function()
-        local arg = ffi.new("int[20]", {1, 400, 1, 1, 2, 400, 1, 1, 0})
-        return ffi.C.sqlite3BitvecBuiltinTest(400, arg )
-    end, 0)
-
-test:do_test(
-    "bitvec-1.10",
-    function()
-        local arg = ffi.new("int[20]", {1, 4000, 1, 1, 2, 4000, 1, 1, 0})
-        return ffi.C.sqlite3BitvecBuiltinTest(4000, arg )
-    end, 0)
-
-test:do_test(
-    "bitvec-1.11",
-    function()
-        local arg = ffi.new("int[20]", {1, 40000, 1, 1, 2, 40000, 1, 1, 0})
-        return ffi.C.sqlite3BitvecBuiltinTest(40000, arg )
-    end, 0)
-
-test:do_test(
-    "bitvec-1.12",
-    function()
-        local arg = ffi.new("int[20]", {1, 400000, 1, 1, 2, 400000, 1, 1, 0})
-        return ffi.C.sqlite3BitvecBuiltinTest(400000, arg )
-    end, 0)
-
-test:do_test(
-    "bitvec-1.13",
-    function()
-        local arg = ffi.new("int[20]", {1, 400, 1, 1, 2, 400, 1, 7, 0})
-        return ffi.C.sqlite3BitvecBuiltinTest(400, arg )
-    end, 0)
-
-test:do_test(
-    "bitvec-1.15",
-    function()
-        local arg = ffi.new("int[20]", {1, 4000, 1, 1, 2, 4000, 1, 7, 0})
-        return ffi.C.sqlite3BitvecBuiltinTest(4000, arg )
-    end, 0)
-
-test:do_test(
-    "bitvec-1.16",
-    function()
-        local arg = ffi.new("int[20]", {1, 40000, 1, 1, 2, 40000, 1, 77, 0})
-        return ffi.C.sqlite3BitvecBuiltinTest(40000, arg )
-    end, 0)
-
-test:do_test(
-    "bitvec-1.17",
-    function()
-        local arg = ffi.new("int[20]", {1, 400000, 1, 1, 2, 400000, 1, 777, 0})
-        return ffi.C.sqlite3BitvecBuiltinTest(400000, arg )
-    end, 0)
-
-test:do_test(
-    "bitvec-1.18",
-    function()
-        local arg = ffi.new("int[20]", {1, 5000, 100000, 1, 2, 400000, 1, 37, 0})
-        return ffi.C.sqlite3BitvecBuiltinTest(400000, arg )
-    end, 0)
-
--- Attempt to induce hash collisions.  
---
--- ["unset","-nocomplain","start"]
--- ["unset","-nocomplain","incr"]
-for start = 1, 8, 1 do
-    for incr = 124, 125, 1 do
-        test:do_test(
-            string.format("bitvec-1.20.%s.%s", start, incr),
-            function()
-                local prog = { 1, 60, start, incr, 2, 5000, 1, 1, 0 }
-                local arg = ffi.new("int[20]", prog)
-                return ffi.C.sqlite3BitvecBuiltinTest(5000, arg )
-            end, 0)
-
-    end
-end
-test:do_test(
-    "bitvec-1.30.big_and_slow",
-    function()
-        local arg = ffi.new("int[20]", {1, 17000000, 1, 1, 2, 17000000, 1, 1, 0})
-        return ffi.C.sqlite3BitvecBuiltinTest(17000000, arg )
-    end, 0)
-
--- Test setting and clearing a random subset of bits.
---
-test:do_test(
-    "bitvec-2.1",
-    function()
-        local arg = ffi.new("int[20]", {3, 2000, 4, 2000, 0})
-        return ffi.C.sqlite3BitvecBuiltinTest(4000, arg )
-    end, 0)
-
-test:do_test(
-    "bitvec-2.2",
-    function()
-        local arg = ffi.new("int[30]", {3, 1000, 4, 1000, 3, 1000, 4, 1000, 3, 1000, 4,
-            1000, 3, 1000, 4, 1000, 3, 1000, 4, 1000, 3, 1000, 4, 1000, 0})
-        return ffi.C.sqlite3BitvecBuiltinTest(4000, arg )
-    end, 0)
-
-test:do_test(
-    "bitvec-2.3",
-    function()
-        local arg = ffi.new("int[20]", {3, 10, 0})
-        return ffi.C.sqlite3BitvecBuiltinTest(400000, arg )
-    end, 0)
-
-test:do_test(
-    "bitvec-2.4",
-    function()
-        local arg = ffi.new("int[20]", {3, 10, 2, 4000, 1, 1, 0})
-        return ffi.C.sqlite3BitvecBuiltinTest(4000, arg )
-    end, 0)
-
-test:do_test(
-    "bitvec-2.5",
-    function()
-        local arg = ffi.new("int[20]", {3, 20, 2, 5000, 1, 1, 0})
-        return ffi.C.sqlite3BitvecBuiltinTest(5000, arg )
-    end, 0)
-
-test:do_test(
-    "bitvec-2.6",
-    function()
-        local arg = ffi.new("int[20]", {3, 60, 2, 50000, 1, 1, 0})
-        return ffi.C.sqlite3BitvecBuiltinTest(50000, arg )
-    end, 0)
-
-test:do_test(
-    "bitvec-2.7",
-    function()
-        local arg = ffi.new("int[20]", {1, 25, 121, 125, 1, 50, 121, 125, 2, 25, 121, 125, 0})
-        return ffi.C.sqlite3BitvecBuiltinTest(5000, arg )
-    end, 0)
-
--- This procedure runs sqlite3BitvecBuiltinTest with argments "n" and
--- "program".  But it also causes a malloc error to occur after the
--- "failcnt"-th malloc.  The result should be "0" if no malloc failure
--- occurs or "-1" if there is a malloc failure.
---
--- MUST_WORK_TEST sqlite3_memdebug_fail func was removed (with test_malloc.c)
-if 0>0 then
-local function bitvec_malloc_test(label, failcnt, n, program)
---    do_test $label [subst {
---    sqlite3_memdebug_fail $failcnt
---    set x \[sqlite3BitvecBuiltinTest $n [list $program]\]
---    set nFail \[sqlite3_memdebug_fail -1\]
---    if {\$nFail==0} {
---        set ::go 0
---        set x -1
---        }
---        set x
---        }] -1
-end
-
--- Make sure malloc failures are handled sanily.
---
--- ["unset","-nocomplain","n"]
--- ["unset","-nocomplain","go"]
-go = 1
-X(177, "X!cmd", [=[["save_prng_state"]]=])
-for _ in X(0, "X!for", [=[["set n 0","$go","incr n"]]=]) do
-    X(180, "X!cmd", [=[["restore_prng_state"]]=])
-    bitvec_malloc_test("bitvec-3.1."..n, n, 5000, [[
-      3 60 2 5000 1 1 3 60 2 5000 1 1 3 60 2 5000 1 1 0
-  ]])
-end
-go = 1
-for _ in X(0, "X!for", [=[["set n 0","$go","incr n"]]=]) do
-    X(187, "X!cmd", [=[["restore_prng_state"]]=])
-    bitvec_malloc_test("bitvec-3.2."..n, n, 5000, [[
-      3 600 2 5000 1 1 3 600 2 5000 1 1 3 600 2 5000 1 1 0
-  ]])
-end
-go = 1
-for _ in X(0, "X!for", [=[["set n 1","$go","incr n"]]=]) do
-    bitvec_malloc_test("bitvec-3.3."..n, n, 50000, "1 50000 1 1 0")
-end
-end
-
-test:finish_test()
diff --git a/test/unit/CMakeLists.txt b/test/unit/CMakeLists.txt
index f56ec18997..86431452b2 100644
--- a/test/unit/CMakeLists.txt
+++ b/test/unit/CMakeLists.txt
@@ -38,6 +38,11 @@ add_executable(uuid.test uuid.c unit.c
         ${CMAKE_SOURCE_DIR}/src/random.c)
 target_link_libraries(uuid.test bit core)
 
+add_executable(sql-bitvec.test sql-bitvec.test.c ${CMAKE_SOURCE_DIR}/src/box/sql/bitvec.c
+        ${CMAKE_SOURCE_DIR}/src/box/sql/malloc.c
+        unit.c)
+target_link_libraries(sql-bitvec.test sql box)
+
 add_executable(bps_tree.test bps_tree.cc)
 target_link_libraries(bps_tree.test small misc)
 add_executable(bps_tree_iterator.test bps_tree_iterator.cc)
diff --git a/test/unit/sql-bitvec.result b/test/unit/sql-bitvec.result
new file mode 100644
index 0000000000..cc4a2b4633
--- /dev/null
+++ b/test/unit/sql-bitvec.result
@@ -0,0 +1,28 @@
+	*** run_tests ***
+ok - bitvec-1.0.1
+ok - bitvec-1.0.2
+ok - bitvec-1.1
+ok - bitvec-1.2
+ok - bitvec-1.3
+ok - bitvec-1.4
+ok - bitvec-1.5
+ok - bitvec-1.6
+ok - bitvec-1.7
+ok - bitvec-1.8
+ok - bitvec-1.9
+ok - bitvec-1.10
+ok - bitvec-1.11
+ok - bitvec-1.12
+ok - bitvec-1.13
+ok - bitvec-1.14
+ok - bitvec-1.15
+ok - bitvec-1.16
+ok - bitvec-1.17
+ok - bitvec-2.1
+ok - bitvec-2.2
+ok - bitvec-2.3
+ok - bitvec-2.4
+ok - bitvec-2.5
+ok - bitvec-2.6
+ok - bitvec-2.7
+	*** run_tests: done ***
diff --git a/test/unit/sql-bitvec.test.c b/test/unit/sql-bitvec.test.c
new file mode 100644
index 0000000000..0e4cc75119
--- /dev/null
+++ b/test/unit/sql-bitvec.test.c
@@ -0,0 +1,252 @@
+#include <stdio.h>
+#include <assert.h>
+
+#include <box/sql.h>
+#include "box/sql/sqliteInt.h"
+
+#include "unit.h"
+
+#define size(arr) sizeof(arr) / sizeof(int)
+
+void
+do_test(const char * label, int sz, int * aOp, int argc, int expect,
+        const char * function, int line)
+{
+        int tmp[argc];
+        int i;
+
+        assert(label);
+        assert(aOp);
+        assert(bitvec_sz > 0);
+        assert(aOp_sz > 0);
+
+        memcpy(tmp, aOp, argc * sizeof(int));
+
+        int result = sqlite3BitvecBuiltinTest(sz, aOp);
+        if (result == expect) {
+                printf("ok - %s\n", label);
+        } else {
+                printf("not ok - %s\n", label);
+                printf("Bitvec test failed - %s\n", label);
+                printf("At function %s at line %d\n", function, line);
+                printf("Expected value - %d\n", expect);
+                printf("Returned value - %d\n", result);
+                printf("Args: %d , { ", sz);
+
+                for (i = 0; i < argc; i++) {
+                        printf("%d ", tmp[i]);
+                }
+
+                printf("} \n");
+        }
+}
+
+void
+test_errors()
+{
+        int test_1[] = { 5, 1, 1, 1, 0 };
+        do_test("bitvec-1.0.1", 400, test_1, 5, 1,
+                __FUNCTION__  , __LINE__);
+        int test_2[] = { 5, 1, 234, 1, 0 };
+        do_test("bitvec-1.0.2", 400, test_2, size(test_2), 234,
+                __FUNCTION__ , __LINE__);
+}
+
+void
+test_various_sizes()
+{
+        int test_3[] = { 1, 400, 1, 1, 0 };
+        do_test("bitvec-1.1", 400, test_3, size(test_3), 0,
+                __FUNCTION__ , __LINE__);
+        int test_4[] = { 1, 4000, 1, 1, 0};
+        do_test("bitvec-1.2", 4000, test_4, size(test_4), 0,
+                __FUNCTION__ , __LINE__);
+        int test_5[] = { 1, 40000, 1, 1, 0};
+        do_test("bitvec-1.3", 40000, test_5, size(test_5), 0,
+                __FUNCTION__ , __LINE__);
+        int test_6[] = { 1, 400000, 1, 1, 0};
+        do_test("bitvec-1.4", 400000, test_6, size(test_6), 0,
+                __FUNCTION__ , __LINE__);
+}
+
+void
+test_larger_increments()
+{
+        int test_7[] = { 1, 400, 1, 7, 0};
+        do_test("bitvec-1.5", 400, test_7, size(test_7), 0,
+                __FUNCTION__ , __LINE__);
+        int test_8[] = { 1, 4000, 1, 7, 0};
+        do_test("bitvec-1.6", 4000, test_8, size(test_8), 0,
+                __FUNCTION__ , __LINE__);
+        int test_9[] = { 1,  40000, 1, 7, 0};
+        do_test("bitvec-1.7", 40000, test_9, size(test_9), 0,
+                __FUNCTION__, __LINE__);
+        int test_10[] = { 1, 400000, 1, 7, 0};
+        do_test("bitvec-1.8", 400000, test_10, size(test_10), 0,
+                __FUNCTION__, __LINE__);
+}
+
+void
+test_clearing_mechanism()
+{
+        int test_11[] = {1, 400, 1, 1, 2, 400, 1, 1, 0};
+        do_test("bitvec-1.9", 400, test_11, size(test_11), 0,
+                 __FUNCTION__, __LINE__);
+        int test_12[] = {1, 4000, 1, 1, 2, 4000, 1, 1, 0};
+        do_test("bitvec-1.10", 4000, test_12, size(test_12), 0,
+                __FUNCTION__, __LINE__);
+        int test_13[] = {1, 40000, 1, 1, 2, 40000, 1, 1, 0};
+        do_test("bitvec-1.11", 40000, test_13, size(test_13), 0,
+                __FUNCTION__, __LINE__);
+        int test_14[] = {1, 400000, 1, 1, 2, 400000, 1, 1, 0};
+        do_test("bitvec-1.12", 400000, test_14, size(test_14), 0,
+                __FUNCTION__, __LINE__);
+        int test_15[] = {1, 400, 1, 1, 2, 400, 1, 7, 0};
+        do_test("bitvec-1.13", 400, test_15, size(test_15), 0,
+                __FUNCTION__, __LINE__);
+        int test_16[] = {1, 4000, 1, 1, 2, 4000, 1, 7, 0};
+        do_test("bitvec-1.14", 4000, test_16, size(test_16), 0,
+                __FUNCTION__, __LINE__);
+        int test_17[] = {1, 40000, 1, 1, 2, 40000, 1, 7, 0};
+        do_test("bitvec-1.15", 40000, test_17, size(test_17), 0,
+                __FUNCTION__, __LINE__);
+        int test_18[] = {1, 400000, 1, 1, 2, 400000, 1, 7, 0};
+        do_test("bitvec-1.16", 400000, test_18, size(test_17), 0,
+                __FUNCTION__, __LINE__);
+        int test_19[] = {1, 5000, 100000, 1, 2, 400000, 1, 37, 0};
+        do_test("bitvec-1.17", 40000, test_19, size(test_18), 0,
+                __FUNCTION__, __LINE__);
+}
+
+void
+test_hashing_collisions()
+{
+        int start_values[] = { 1, 8, 1 };
+        int incr_values[] = { 124, 125, 1 };
+        char bitvec[30];
+        int i, j;
+
+        for (i = 0; i < 3; i++) {
+                for (j = 0; j < 3; j++) {
+                        sprintf(bitvec, "bitvec-1.18.%d.%d", i, j);
+                        int test_20[] = { 1, 60, i, j, 2, 5000, 1, 1, 0 };
+                        do_test(bitvec, 5000, test_20, size(test_20), 0,
+                                __FUNCTION__, __LINE__);
+                }
+        }
+
+        int test_30[] = {1, 17000000, 1, 1, 2, 17000000, 1, 1, 0};
+        do_test("bitvec-1.30.big_and_slow", 17000000, test_30, size(test_30), 0,
+                __FUNCTION__, __LINE__);
+}
+
+void
+test_random_subsets()
+{
+        int test_31[] = {3, 2000, 4, 2000, 0};
+        do_test("bitvec-2.1", 4000, test_31, size(test_31), 0,
+                __FUNCTION__, __LINE__);
+
+        int test_32[] = {3, 1000, 4, 1000, 3, 1000, 4, 1000, 3, 1000, 4,
+                         1000, 3, 1000, 4, 1000, 3, 1000, 4, 1000, 3, 1000, 4, 1000, 0};
+        do_test("bitvec-2.2", 4000, test_32, size(test_32), 0,
+                __FUNCTION__, __LINE__);
+
+        int test_33[] = {3, 10, 0};
+        do_test("bitvec-2.3", 400000, test_33, size(test_33), 0,
+                __FUNCTION__, __LINE__);
+
+        int test_34[] = {3, 10, 2, 4000, 1, 1, 0};
+        do_test("bitvec-2.4", 4000, test_34, size(test_34), 0,
+                __FUNCTION__, __LINE__);
+
+        int test_35[] = {3, 20, 2, 5000, 1, 1, 0};
+        do_test("bitvec-2.5", 5000, test_35, size(test_35), 0,
+                __FUNCTION__, __LINE__);
+
+        int test_36[] = {3, 60, 2, 50000, 1, 1, 0};
+        do_test("bitvec-2.6", 50000, test_36, size(test_36), 0,
+                __FUNCTION__, __LINE__);
+
+        int test_37[] = {1, 25, 121, 125, 1, 50, 121, 125, 2, 25, 121, 125, 0};
+        do_test("bitvec-2.7", 5000, test_37, size(test_37), 0,
+                __FUNCTION__, __LINE__);
+}
+
+/*
+ * This is malloc tcl test - needs to be converted
+ *
+ * -- This procedure runs sqlite3BitvecBuiltinTest with argments "n" and
+-- "program".  But it also causes a malloc error to occur after the
+-- "failcnt"-th malloc.  The result should be "0" if no malloc failure
+-- occurs or "-1" if there is a malloc failure.
+--
+-- MUST_WORK_TEST sqlite3_memdebug_fail func was removed (with test_malloc.c)
+if 0>0 then
+local function bitvec_malloc_test(label, failcnt, n, program)
+--    do_test $label [subst {
+--    sqlite3_memdebug_fail $failcnt
+--    set x \[sqlite3BitvecBuiltinTest $n [list $program]\]
+--    set nFail \[sqlite3_memdebug_fail -1\]
+--    if {\$nFail==0} {
+--        set ::go 0
+--        set x -1
+--        }
+--        set x
+--        }] -1
+end
+
+-- Make sure malloc failures are handled sanily.
+--
+-- ["unset","-nocomplain","n"]
+-- ["unset","-nocomplain","go"]
+go = 1
+X(177, "X!cmd", [=[["save_prng_state"]]=])
+for _ in X(0, "X!for", [=[["set n 0","$go","incr n"]]=]) do
+    X(180, "X!cmd", [=[["restore_prng_state"]]=])
+    bitvec_malloc_test("bitvec-3.1."..n, n, 5000, [[
+      3 60 2 5000 1 1 3 60 2 5000 1 1 3 60 2 5000 1 1 0
+  ]])
+end
+go = 1
+for _ in X(0, "X!for", [=[["set n 0","$go","incr n"]]=]) do
+    X(187, "X!cmd", [=[["restore_prng_state"]]=])
+    bitvec_malloc_test("bitvec-3.2."..n, n, 5000, [[
+      3 600 2 5000 1 1 3 600 2 5000 1 1 3 600 2 5000 1 1 0
+  ]])
+end
+go = 1
+for _ in X(0, "X!for", [=[["set n 1","$go","incr n"]]=]) do
+    bitvec_malloc_test("bitvec-3.3."..n, n, 50000, "1 50000 1 1 0")
+end
+end
+*
+*/
+
+void
+run_tests(void)
+{
+        header();
+
+        test_errors();
+        test_various_sizes();
+        test_larger_increments();
+        test_clearing_mechanism();
+        test_random_subsets();
+
+        footer();
+}
+
+int
+main(void)
+{
+        sqlite3MutexInit();
+        sqlite3MallocInit();
+
+        run_tests();
+
+        sqlite3MallocEnd();
+        sqlite3MutexEnd();
+
+        return 0;
+}
-- 
GitLab