sqlite
[Ported from github.com/sqlite/sqlite] Fix bugs in and improve the interface to the ".check" command of the CLI.
Brought by drakestapleton
| 1 | # 2024 Jan 23 |
| 2 | # |
| 3 | # The author disclaims copyright to this source code. In place of |
| 4 | # 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 | # This file implements regression tests for SQLite library. |
| 12 | # |
| 13 | |
| 14 | #################################################### |
| 15 | # DO NOT EDIT! THIS FILE IS AUTOMATICALLY GENERATED! |
| 16 | #################################################### |
| 17 | |
| 18 | set testdir [file dirname $argv0] |
| 19 | source $testdir/tester.tcl |
| 20 | set testprefix literal2 |
| 21 | |
| 22 | do_execsql_test 1.0 { |
| 23 | SELECT 123_456 |
| 24 | } {123456} |
| 25 | |
| 26 | # PG says ERROR: trailing junk after numeric literal at or near "123_" |
| 27 | do_test 1.1 { catch { execsql { |
| 28 | SELECT 123__456 |
| 29 | } } } 1 |
| 30 | |
| 31 | |
| 32 | do_test 2.1 { |
| 33 | set myres {} |
| 34 | foreach r [db eval {SELECT 1.0e1_2}] { |
| 35 | lappend myres [format %.4f [set r]] |
| 36 | } |
| 37 | set res2 {1000000000000.0000} |
| 38 | set i 0 |
| 39 | foreach r [set myres] r2 [set res2] { |
| 40 | if {[set r]<([set r2]-0.0001) || [set r]>([set r2]+0.0001)} { |
| 41 | error "list element [set i] does not match: got=[set r] expected=[set r2]" |
| 42 | } |
| 43 | incr i |
| 44 | } |
| 45 | set {} {} |
| 46 | } {} |
| 47 | |
| 48 | do_execsql_test 3.0.0 { |
| 49 | SELECT 0xFF_FF |
| 50 | } {65535} |
| 51 | |
| 52 | do_execsql_test 3.0.1 { |
| 53 | SELECT 0xFF_EF |
| 54 | } {65519} |
| 55 | |
| 56 | # PG says ERROR: trailing junk after numeric literal at or near "0xFF_" |
| 57 | do_test 3.0.2 { catch { execsql { |
| 58 | SELECT 0xFF__EF |
| 59 | } } } 1 |
| 60 | |
| 61 | # PG says ERROR: trailing junk after numeric literal at or near "0xFFEF_" |
| 62 | do_test 3.0.4 { catch { execsql { |
| 63 | SELECT 0xFFEF_ |
| 64 | } } } 1 |
| 65 | |
| 66 | do_execsql_test 3.1.0 { |
| 67 | SELECT 0XFF_FF |
| 68 | } {65535} |
| 69 | |
| 70 | do_execsql_test 3.1.1 { |
| 71 | SELECT 0XFF_EF |
| 72 | } {65519} |
| 73 | |
| 74 | # PG says ERROR: trailing junk after numeric literal at or near "0XFF_" |
| 75 | do_test 3.1.2 { catch { execsql { |
| 76 | SELECT 0XFF__EF |
| 77 | } } } 1 |
| 78 | |
| 79 | # PG says ERROR: trailing junk after numeric literal at or near "0XFFEF_" |
| 80 | do_test 3.1.4 { catch { execsql { |
| 81 | SELECT 0XFFEF_ |
| 82 | } } } 1 |
| 83 | |
| 84 | finish_test |