Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Add a failing test and supporting functions. When the buffer is ended by a passed-in byte count instead of a trailing 0, sqlite4_num_from_text returns NaN |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | num_work |
Files: | files | file ages | folders |
SHA1: |
2cff3b428a29acb7031eb76dfe3b965e |
User & Date: | peterreid 2013-02-10 04:26:15.287 |
Context
2013-02-10
| ||
19:21 | Fix defect in which sqlite4_num_from_text returns NaN if it uses exactly as many bytes as the caller allows. check-in: 24ee36b76f user: peterreid tags: num_work | |
04:26 | Add a failing test and supporting functions. When the buffer is ended by a passed-in byte count instead of a trailing 0, sqlite4_num_from_text returns NaN check-in: 2cff3b428a user: peterreid tags: num_work | |
04:06 | Add a few sqlite4_num tests. check-in: 6cc07d19e4 user: peterreid tags: num_work | |
Changes
Changes to test/num.test.
︙ | ︙ | |||
25 26 27 28 29 30 31 32 33 | do_test num-equal-1.1.3 { sqlite4_num_compare -00034 -3.4e1 } {equal} # Is +0 > -0? #do_test num-equal-1.1.4 { # sqlite4_num_compare +0 -0 #} {equal} finish_test | > > > > > > > | 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | do_test num-equal-1.1.3 { sqlite4_num_compare -00034 -3.4e1 } {equal} # Is +0 > -0? #do_test num-equal-1.1.4 { # sqlite4_num_compare +0 -0 #} {equal} do_test num-2.1.1 { sqlite4_num_to_text [sqlite4_num_from_text 37] } {37} do_test num-2.1.2 { sqlite4_num_to_text [sqlite4_num_from_text 37 2] } {37} finish_test |
Changes to test/test_main.c.
︙ | ︙ | |||
4437 4438 4439 4440 4441 4442 4443 4444 4445 4446 4447 4448 4449 4450 | len = -1; } A = sqlite4_num_from_text( argv[1], len, 0 ); append_num_result(interp, A); return TCL_OK; } /* ** Register commands with the TCL interpreter. */ int Sqlitetest1_Init(Tcl_Interp *interp){ extern int sqlite4_search_count; extern int sqlite4_found_count; | > > > > > > > > > > > > > > > > > | 4437 4438 4439 4440 4441 4442 4443 4444 4445 4446 4447 4448 4449 4450 4451 4452 4453 4454 4455 4456 4457 4458 4459 4460 4461 4462 4463 4464 4465 4466 4467 | len = -1; } A = sqlite4_num_from_text( argv[1], len, 0 ); append_num_result(interp, A); return TCL_OK; } static int test_num_to_text( void *NotUsed, Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int argc, /* Number of arguments */ char **argv /* Text of each argument */ ){ char text[30]; if( argc!=2 ){ Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], " NUM\"", 0); return TCL_ERROR; } sqlite4_num_to_text( test_parse_num( argv[1] ), text ); Tcl_AppendResult( interp, text, 0 ); return TCL_OK; } /* ** Register commands with the TCL interpreter. */ int Sqlitetest1_Init(Tcl_Interp *interp){ extern int sqlite4_search_count; extern int sqlite4_found_count; |
︙ | ︙ | |||
4493 4494 4495 4496 4497 4498 4499 4500 4501 4502 4503 4504 4505 4506 | { "sqlite_delete_collation", (Tcl_CmdProc*)delete_collation }, { "sqlite4_get_autocommit", (Tcl_CmdProc*)get_autocommit }, { "sqlite4_stack_used", (Tcl_CmdProc*)test_stack_used }, { "printf", (Tcl_CmdProc*)test_printf }, { "sqlite4IoTrace", (Tcl_CmdProc*)test_io_trace }, { "sqlite4_num_compare", (Tcl_CmdProc*)test_num_compare }, { "sqlite4_num_from_text", (Tcl_CmdProc*)test_num_from_text }, }; static struct { char *zName; Tcl_ObjCmdProc *xProc; void *clientData; } aObjCmd[] = { { "sqlite4_connection_pointer", get_sqlite_pointer, 0 }, | > | 4510 4511 4512 4513 4514 4515 4516 4517 4518 4519 4520 4521 4522 4523 4524 | { "sqlite_delete_collation", (Tcl_CmdProc*)delete_collation }, { "sqlite4_get_autocommit", (Tcl_CmdProc*)get_autocommit }, { "sqlite4_stack_used", (Tcl_CmdProc*)test_stack_used }, { "printf", (Tcl_CmdProc*)test_printf }, { "sqlite4IoTrace", (Tcl_CmdProc*)test_io_trace }, { "sqlite4_num_compare", (Tcl_CmdProc*)test_num_compare }, { "sqlite4_num_from_text", (Tcl_CmdProc*)test_num_from_text }, { "sqlite4_num_to_text", (Tcl_CmdProc*)test_num_to_text }, }; static struct { char *zName; Tcl_ObjCmdProc *xProc; void *clientData; } aObjCmd[] = { { "sqlite4_connection_pointer", get_sqlite_pointer, 0 }, |
︙ | ︙ |