#!/usr/bin/env tclsh

set testdir [file dirname $argv0]
source $testdir/tester.tcl

do_execsql_test numberic-literal-1 {
  SELECT 45;
} {45}

do_execsql_test numberic-literal-2 {
  SELECT 0x7FFFFFFFFFFFFFFF;
} {9223372036854775807}

do_execsql_test numberic-literal-3 {
  SELECT -0x7FFFFFFFFFFFFFFF;
} {-9223372036854775807}

do_execsql_test numberic-literal-4 {
  SELECT +0x7FFFFFFFFFFFFFFF;
} {9223372036854775807}

do_execsql_test numberic-literal-5 {
  SELECT 9_223_372_036_854_775_807;
} {9223372036854775807}

do_execsql_test numberic-literal-6 {
  SELECT -9_223_372_036_854_775_808;
} {-9223372036854775808}

do_execsql_test numberic-literal-7 {
  SELECT 1_000;
} {1000}

do_execsql_test numberic-literal-8 {
  SELECT 1.1_1;
} {1.11}

do_execsql_test numberic-literal-9 {
  SELECT 1e12;
} {1000000000000.0}

do_execsql_test numberic-literal-10 {
  SELECT 1.0;
} {1.0}

do_execsql_test numberic-literal-11 {
  SELECT 1e1000;
} {Inf}

do_execsql_test numberic-literal-12 {
  SELECT -1e1000;
} {-Inf}

do_execsql_test numberic-literal-13 {
  SELECT 1e1_000;
} {Inf}

do_execsql_test numberic-literal-14 {
  SELECT 12_3_456.7_8_9;
} {123456.789}

do_execsql_test numberic-literal-exceed-max-i64 {
  SELECT 9_223_372_036_854_775_808;
} {9.22337203685478e+18}

do_execsql_test numberic-literal-exceed-min-i64 {
  SELECT -9_223_372_036_854_775_809;
} {-9.22337203685478e+18}

do_execsql_test_any_error invalid-numberic-literal-1 {
  SELECT 0xFF__FF;
}

do_execsql_test_any_error invalid-numberic-literal-2 {
  SELECT 12a3;
}

do_execsql_test_any_error invalid-numberic-literal-3 {
  SELECT e12;
}

do_execsql_test_any_error invalid-numberic-literal-4 {
  SELECT 1e;
}
