CoolFace
Modelpublic

AryaWu/sqlite

sourceHugging Faceupdated 9mo agoView on Hugging Face
0likes
json108.test46 linesDownload Raw Back to test
1# 2024-03-062#3# The author disclaims copyright to this source code.  In place of4# a legal notice, here is a blessing:5#6#    May you do good and not evil.7#    May you find forgiveness for yourself and forgive others.8#    May you share freely, never taking more than you give.9#10#***********************************************************************11# Invariant tests for JSON built around the randomjson extension12#13 14set testdir [file dirname $argv0]15source $testdir/tester.tcl16set testprefix json10817 18# These tests require virtual table "json_tree" to run.19ifcapable !vtab { finish_test ; return }20 21load_static_extension db randomjson22db eval {23  CREATE TEMP TABLE t1(j0,j5);24  WITH RECURSIVE c(n) AS (VALUES(0) UNION ALL SELECT n+1 FROM c WHERE n<9)25  INSERT INTO t1 SELECT random_json(n), random_json5(n) FROM c;26}27 28do_execsql_test 1.1 {29  SELECT count(*) FROM t1 WHERE json(j0)==json(json_pretty(j0,NULL));30} 1031do_execsql_test 1.2 {32  SELECT count(*) FROM t1 WHERE json(j0)==json(json_pretty(j0,NULL));33} 1034do_execsql_test 1.3 {35  SELECT count(*) FROM t1 WHERE json(j0)==json(json_pretty(j0,''));36} 1037do_execsql_test 1.4 {38  SELECT count(*) FROM t1 WHERE json(j0)==json(json_pretty(j0,char(9)));39} 1040do_execsql_test 1.5 {41  SELECT count(*) FROM t1 WHERE json(j0)==json(json_pretty(j0,'/*hello*/'));42} 1043 44 45finish_test46