OLD | NEW |
1 # 2001 September 15 | 1 # 2001 September 15 |
2 # | 2 # |
3 # The author disclaims copyright to this source code. In place of | 3 # The author disclaims copyright to this source code. In place of |
4 # a legal notice, here is a blessing: | 4 # a legal notice, here is a blessing: |
5 # | 5 # |
6 # May you do good and not evil. | 6 # May you do good and not evil. |
7 # May you find forgiveness for yourself and forgive others. | 7 # May you find forgiveness for yourself and forgive others. |
8 # May you share freely, never taking more than you give. | 8 # May you share freely, never taking more than you give. |
9 # | 9 # |
10 #*********************************************************************** | 10 #*********************************************************************** |
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
465 0xff676981 0xff676981 0xff676981 | 465 0xff676981 0xff676981 0xff676981 |
466 } {abc: (-9999999) (ff676981) (37731664601) :xyz} | 466 } {abc: (-9999999) (ff676981) (37731664601) :xyz} |
467 do_test printf-1.16.6 { | 467 do_test printf-1.16.6 { |
468 sqlite3_mprintf_int {abc: (% 6d) (% 6x) (% 6o) :xyz}\ | 468 sqlite3_mprintf_int {abc: (% 6d) (% 6x) (% 6o) :xyz}\ |
469 0xff676981 0xff676981 0xff676981 | 469 0xff676981 0xff676981 0xff676981 |
470 } {abc: (-9999999) (ff676981) (37731664601) :xyz} | 470 } {abc: (-9999999) (ff676981) (37731664601) :xyz} |
471 do_test printf-1.16.7 { | 471 do_test printf-1.16.7 { |
472 sqlite3_mprintf_int {abc: (%#6d) (%#6x) (%#6o) :xyz}\ | 472 sqlite3_mprintf_int {abc: (%#6d) (%#6x) (%#6o) :xyz}\ |
473 0xff676981 0xff676981 0xff676981 | 473 0xff676981 0xff676981 0xff676981 |
474 } {abc: (-9999999) (0xff676981) (037731664601) :xyz} | 474 } {abc: (-9999999) (0xff676981) (037731664601) :xyz} |
| 475 do_test printf-1.17.1 { |
| 476 sqlite3_mprintf_int {abd: %2147483647d %2147483647x %2147483647o} 1 1 1 |
| 477 } {} |
| 478 do_test printf-1.17.2 { |
| 479 sqlite3_mprintf_int {abd: %*d %x} 2147483647 1 1 |
| 480 } {} |
| 481 do_test printf-1.17.3 { |
| 482 sqlite3_mprintf_int {abd: %*d %x} -2147483648 1 1 |
| 483 } {abd: 1 1} |
| 484 do_test printf-1.17.4 { |
| 485 sqlite3_mprintf_int {abd: %.2147483648d %x %x} 1 1 1 |
| 486 } {/.*/} |
475 do_test printf-2.1.1.1 { | 487 do_test printf-2.1.1.1 { |
476 sqlite3_mprintf_double {abc: (%*.*f) :xyz} 1 1 0.001 | 488 sqlite3_mprintf_double {abc: (%*.*f) :xyz} 1 1 0.001 |
477 } {abc: (0.0) :xyz} | 489 } {abc: (0.0) :xyz} |
478 do_test printf-2.1.1.2 { | 490 do_test printf-2.1.1.2 { |
479 sqlite3_mprintf_double {abc: (%*.*e) :xyz} 1 1 0.001 | 491 sqlite3_mprintf_double {abc: (%*.*e) :xyz} 1 1 0.001 |
480 } {abc: (1.0e-03) :xyz} | 492 } {abc: (1.0e-03) :xyz} |
481 do_test printf-2.1.1.3 { | 493 do_test printf-2.1.1.3 { |
482 sqlite3_mprintf_double {abc: (%*.*g) :xyz} 1 1 0.001 | 494 sqlite3_mprintf_double {abc: (%*.*g) :xyz} 1 1 0.001 |
483 } {abc: (0.001) :xyz} | 495 } {abc: (0.001) :xyz} |
484 do_test printf-2.1.1.4 { | 496 do_test printf-2.1.1.4 { |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
519 } {abc: 1 1 (000001e-20) :xyz} | 531 } {abc: 1 1 (000001e-20) :xyz} |
520 do_test printf-2.1.2.7 { | 532 do_test printf-2.1.2.7 { |
521 sqlite3_mprintf_double {abc: %d %d (%1.1f) :xyz} 1 1 1.0e-20 | 533 sqlite3_mprintf_double {abc: %d %d (%1.1f) :xyz} 1 1 1.0e-20 |
522 } {abc: 1 1 (0.0) :xyz} | 534 } {abc: 1 1 (0.0) :xyz} |
523 do_test printf-2.1.2.8 { | 535 do_test printf-2.1.2.8 { |
524 sqlite3_mprintf_double {abc: %d %d (%1.1e) :xyz} 1 1 1.0e-20 | 536 sqlite3_mprintf_double {abc: %d %d (%1.1e) :xyz} 1 1 1.0e-20 |
525 } {abc: 1 1 (1.0e-20) :xyz} | 537 } {abc: 1 1 (1.0e-20) :xyz} |
526 do_test printf-2.1.2.9 { | 538 do_test printf-2.1.2.9 { |
527 sqlite3_mprintf_double {abc: %d %d (%1.1g) :xyz} 1 1 1.0e-20 | 539 sqlite3_mprintf_double {abc: %d %d (%1.1g) :xyz} 1 1 1.0e-20 |
528 } {abc: 1 1 (1e-20) :xyz} | 540 } {abc: 1 1 (1e-20) :xyz} |
| 541 do_test printf-2.1.2.10 { |
| 542 sqlite3_mprintf_double {abc: %*.*f} 2000000000 1000000000 1.0e-20 |
| 543 } {abc: } |
529 do_test printf-2.1.3.1 { | 544 do_test printf-2.1.3.1 { |
530 sqlite3_mprintf_double {abc: (%*.*f) :xyz} 1 1 1.0 | 545 sqlite3_mprintf_double {abc: (%*.*f) :xyz} 1 1 1.0 |
531 } {abc: (1.0) :xyz} | 546 } {abc: (1.0) :xyz} |
532 do_test printf-2.1.3.2 { | 547 do_test printf-2.1.3.2 { |
533 sqlite3_mprintf_double {abc: (%*.*e) :xyz} 1 1 1.0 | 548 sqlite3_mprintf_double {abc: (%*.*e) :xyz} 1 1 1.0 |
534 } {abc: (1.0e+00) :xyz} | 549 } {abc: (1.0e+00) :xyz} |
535 do_test printf-2.1.3.3 { | 550 do_test printf-2.1.3.3 { |
536 sqlite3_mprintf_double {abc: (%*.*g) :xyz} 1 1 1.0 | 551 sqlite3_mprintf_double {abc: (%*.*g) :xyz} 1 1 1.0 |
537 } {abc: (1) :xyz} | 552 } {abc: (1) :xyz} |
538 do_test printf-2.1.3.4 { | 553 do_test printf-2.1.3.4 { |
(...skipping 2920 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3459 } [format {A String: (%*.*s)} -10 5 {This is the string}] | 3474 } [format {A String: (%*.*s)} -10 5 {This is the string}] |
3460 do_test printf-3.4 { | 3475 do_test printf-3.4 { |
3461 sqlite3_mprintf_str {%d %d A String: (%s)} 1 2 {This is the string} | 3476 sqlite3_mprintf_str {%d %d A String: (%s)} 1 2 {This is the string} |
3462 } [format {%d %d A String: (%s)} 1 2 {This is the string}] | 3477 } [format {%d %d A String: (%s)} 1 2 {This is the string}] |
3463 do_test printf-3.5 { | 3478 do_test printf-3.5 { |
3464 sqlite3_mprintf_str {%d %d A String: (%30s)} 1 2 {This is the string} | 3479 sqlite3_mprintf_str {%d %d A String: (%30s)} 1 2 {This is the string} |
3465 } [format {%d %d A String: (%30s)} 1 2 {This is the string}] | 3480 } [format {%d %d A String: (%30s)} 1 2 {This is the string}] |
3466 do_test printf-3.6 { | 3481 do_test printf-3.6 { |
3467 sqlite3_mprintf_str {%d %d A String: (%-30s)} 1 2 {This is the string} | 3482 sqlite3_mprintf_str {%d %d A String: (%-30s)} 1 2 {This is the string} |
3468 } [format {%d %d A String: (%-30s)} 1 2 {This is the string}] | 3483 } [format {%d %d A String: (%-30s)} 1 2 {This is the string}] |
| 3484 do_test printf-3.7 { |
| 3485 sqlite3_mprintf_str {%d A String: (%*s)} 1 2147483647 {This is the string} |
| 3486 } [] |
| 3487 do_test printf-3.8 { |
| 3488 sqlite3_mprintf_str {%d A String: (%*s)} 1 -2147483648 {This is the string} |
| 3489 } {1 A String: (This is the string)} |
| 3490 do_test printf-3.9 { |
| 3491 sqlite3_mprintf_str {%d A String: (%.*s)} 1 -2147483648 {This is the string} |
| 3492 } {1 A String: (This is the string)} |
3469 do_test snprintf-3.11 { | 3493 do_test snprintf-3.11 { |
3470 sqlite3_snprintf_str 2 {x%d %d %s} 10 10 {This is the string} | 3494 sqlite3_snprintf_str 2 {x%d %d %s} 10 10 {This is the string} |
3471 } {x} | 3495 } {x} |
3472 do_test snprintf-3.12 { | 3496 do_test snprintf-3.12 { |
3473 sqlite3_snprintf_str 3 {x%d %d %s} 10 10 {This is the string} | 3497 sqlite3_snprintf_str 3 {x%d %d %s} 10 10 {This is the string} |
3474 } {x1} | 3498 } {x1} |
3475 do_test snprintf-3.13 { | 3499 do_test snprintf-3.13 { |
3476 sqlite3_snprintf_str 4 {x%d %d %s} 10 10 {This is the string} | 3500 sqlite3_snprintf_str 4 {x%d %d %s} 10 10 {This is the string} |
3477 } {x10} | 3501 } {x10} |
3478 do_test snprintf-3.14 { | 3502 do_test snprintf-3.14 { |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3678 } {100000000000000000000000000000000.00000000000000000000} | 3702 } {100000000000000000000000000000000.00000000000000000000} |
3679 do_test printf-13.4 { | 3703 do_test printf-13.4 { |
3680 sqlite3_mprintf_hexdouble %.20f 7ff0000000000000 | 3704 sqlite3_mprintf_hexdouble %.20f 7ff0000000000000 |
3681 } {Inf} | 3705 } {Inf} |
3682 do_test printf-13.5 { | 3706 do_test printf-13.5 { |
3683 sqlite3_mprintf_hexdouble %.20f fff0000000000000 | 3707 sqlite3_mprintf_hexdouble %.20f fff0000000000000 |
3684 } {-Inf} | 3708 } {-Inf} |
3685 do_test printf-13.6 { | 3709 do_test printf-13.6 { |
3686 sqlite3_mprintf_hexdouble %.20f fff8000000000000 | 3710 sqlite3_mprintf_hexdouble %.20f fff8000000000000 |
3687 } {NaN} | 3711 } {NaN} |
| 3712 do_test printf-13.7 { |
| 3713 sqlite3_mprintf_hexdouble %2147483648.10000f 4693b8b5b5056e17 |
| 3714 } {/100000000000000000000000000000000.00/} |
3688 | 3715 |
3689 do_test printf-14.1 { | 3716 do_test printf-14.1 { |
3690 sqlite3_mprintf_str {abc-%y-123} 0 0 {not used} | 3717 sqlite3_mprintf_str {abc-%y-123} 0 0 {not used} |
3691 } {abc-} | 3718 } {abc-} |
3692 do_test printf-14.2 { | 3719 do_test printf-14.2 { |
3693 sqlite3_mprintf_n_test {xyzzy} | 3720 sqlite3_mprintf_n_test {xyzzy} |
3694 } 5 | 3721 } 5 |
3695 do_test printf-14.3 { | 3722 do_test printf-14.3 { |
3696 sqlite3_mprintf_str {abc-%T-123} 0 0 {not used} | 3723 sqlite3_mprintf_str {abc-%T-123} 0 0 {not used} |
3697 } {abc-} | 3724 } {abc-} |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3746 do_test printf-malloc-$::iRepeat.$nTestNum { | 3773 do_test printf-malloc-$::iRepeat.$nTestNum { |
3747 expr {($nFail>0 && $z eq "") || ($nFail==$nBenign && $z eq $zSuccess)} | 3774 expr {($nFail>0 && $z eq "") || ($nFail==$nBenign && $z eq $zSuccess)} |
3748 } {1} | 3775 } {1} |
3749 if {$nFail == 0} break | 3776 if {$nFail == 0} break |
3750 incr nTestNum | 3777 incr nTestNum |
3751 } | 3778 } |
3752 } | 3779 } |
3753 } | 3780 } |
3754 | 3781 |
3755 finish_test | 3782 finish_test |
OLD | NEW |