SQLite4
Check-in [abaf3f1abd]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Change some repetitive num tests into loops.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: abaf3f1abd8a8d59867484e056d305d2eb2c91e3
User & Date: peterreid 2013-07-06 23:07:47
Context
2013-07-06
23:14
Add tests for sqlite4_num_sub with inf and nan. check-in: ed79d6f7fa user: peterreid tags: trunk
23:07
Change some repetitive num tests into loops. check-in: abaf3f1abd user: peterreid tags: trunk
22:55
Remove unused variables from sqlite4_num_mul. check-in: 1d4a5055fa user: peterreid tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to test/num.test.

56
57
58
59
60
61
62
63
64

65
66
67
68


69
70
71
72
73
74
75

76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105


106
107
108
109
110
111
112
  sqlite4_num_isinf [sqlite4_num_from_text inf 3]
} {true}

do_test num-3.1.1 {
  sqlite4_num_to_text [sqlite4_num_add 5 7]
} {12}

do_test num-4.1.1 {
  sqlite4_num_to_text [sqlite4_num_sub 9 3]

} {6}
do_test num-4.1.2 {
  sqlite4_num_to_text [sqlite4_num_sub 5 12]
} {-7}


do_test num-4.2.1 {
  sqlite4_num_compare [sqlite4_num_sub 1 1] [sqlite4_num_sub -1 -1]
} {equal}

do_test num-5.1.1 {
  sqlite4_num_to_text [sqlite4_num_mul 9 8]
} {72}

do_test num-5.1.2 {
  sqlite4_num_to_text [sqlite4_num_mul NaN inf]
} {NaN}
do_test num-5.1.3 {
  sqlite4_num_to_text [sqlite4_num_mul inf NaN]
} {NaN}
do_test num-5.1.4 {
  sqlite4_num_to_text [sqlite4_num_mul inf 0]
} {NaN}
do_test num-5.1.5 {
  sqlite4_num_to_text [sqlite4_num_mul inf -inf]
} {-inf}
do_test num-5.1.6 {
  sqlite4_num_to_text [sqlite4_num_mul NaN 0]
} {NaN}
do_test num-5.1.7 {
  sqlite4_num_to_text [sqlite4_num_mul NaN 1]
} {NaN}
do_test num-5.1.8 {
  sqlite4_num_to_text [sqlite4_num_mul NaN -9]
} {NaN}
do_test num-5.1.9 {
  sqlite4_num_to_text [sqlite4_num_mul NaN NaN]
} {NaN}
do_test num-5.1.10 {
  sqlite4_num_to_text [sqlite4_num_mul inf 3]
} {inf}
do_test num-5.1.11 {
  sqlite4_num_to_text [sqlite4_num_mul inf -9]
} {-inf}



do_test num-6.1.1 {
  sqlite4_num_to_text [sqlite4_num_div 6 5]
} {1.2}
do_test num-6.1.2 {
  sqlite4_num_compare 2 [sqlite4_num_div 2 1]
} {equal}







|
|
>
|
|
|
<
>
>




<
<
<
>
|
|
|
|
|
|
|
|
|
|
<
|
|
|
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
>
>







56
57
58
59
60
61
62
63
64
65
66
67
68

69
70
71
72
73
74



75
76
77
78
79
80
81
82
83
84
85

86
87
88
















89
90
91
92
93
94
95
96
97
  sqlite4_num_isinf [sqlite4_num_from_text inf 3]
} {true}

do_test num-3.1.1 {
  sqlite4_num_to_text [sqlite4_num_add 5 7]
} {12}

foreach {tn a b sum} {
  1   9       3       6
  2   5       12      -7
} {
  do_test num-4.1.$tn {
   sqlite4_num_to_text [sqlite4_num_sub $a $b] 

  } $sum
}
do_test num-4.2.1 {
  sqlite4_num_compare [sqlite4_num_sub 1 1] [sqlite4_num_sub -1 -1]
} {equal}





foreach {tn a b product} {
  1   9       8       72
  2   NaN     inf     NaN
  3   inf     NaN     NaN
  4   inf     0       NaN
  5   inf     -inf    -inf
  6   NaN     0       NaN
  7   NaN     1       NaN
  8   NaN     -9      NaN
  9   NaN     NaN     NaN

} { 
  do_test num-5.1.$tn {
    sqlite4_num_to_text [sqlite4_num_mul $a $b]
















  } $product
}

do_test num-6.1.1 {
  sqlite4_num_to_text [sqlite4_num_div 6 5]
} {1.2}
do_test num-6.1.2 {
  sqlite4_num_compare 2 [sqlite4_num_div 2 1]
} {equal}