System.Data.SQLite
Check-in [55359b6e3c]
Not logged in

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

Overview
Comment:Add more tests.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | newJulianDay
Files: files | file ages | folders
SHA1: 55359b6e3ca83cb7addd12a1cfece226c92d79e1
User & Date: mistachkin 2014-11-01 22:58:04
Context
2014-11-14
00:19
Handle Julian Day values that fall outside of the supported range for OLE Automation dates. Fix for [3e783eecbe]. check-in: 3bd76a0c9d user: mistachkin tags: trunk
2014-11-01
22:58
Add more tests. Closed-Leaf check-in: 55359b6e3c user: mistachkin tags: newJulianDay
21:10
Improve coding style. check-in: 4a5306964c user: mistachkin tags: newJulianDay
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to Tests/tkt-3e783eecbe.eagle.

42
43
44
45
46
47
48

49
50
51
52
53
54
55
..
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
..
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
    set code [catch {
      object invoke System.Data.SQLite.SQLiteConvert ToJulianDay \
          $dateTimeValue
    } result]

    if {$code != 0} then {
      regexp -- {---> (.*?):} $result result result

    }

    lappend results [list [$dateTimeValue ToString [getDateTimeFormat]] \
        $code $result]
  }

  set results
................................................................................
###############################################################################

runTest {test tkt-3e783eecbe-1.2 {From Julian Day w/o OLE Automation} -setup {
  set minDoubleValue [object invoke -create -alias Double MinValue]
  set maxDoubleValue [object invoke -create -alias Double MaxValue]

  set doubleValues [list \
      $minDoubleValue -1.0 0.0 1.0 1721425.5 2451910.5 2456962.0 \
      5373484.49999998 5373484.49999999 $maxDoubleValue]
} -body {
  set results [list]

  foreach doubleValue $doubleValues {
    if {$doubleValue ni [info objects]} then {
      set doubleValue [object invoke \
          -create -alias Double Parse $doubleValue]
................................................................................
          System.Data.SQLite.SQLiteConvert ToDateTime $doubleValue Utc]

      $dateTimeValue ToString [getDateTimeFormat]
    } result]

    if {$code != 0} then {
      regexp -- {---> (.*?):} $result result result

    }

    lappend results [list [$doubleValue ToString] $code $result]
  }

  set results
} -cleanup {
  unset -nocomplain code result results dateTimeValue doubleValue \
      doubleValues maxDoubleValue minDoubleValue
} -constraints {eagle System.Data.SQLite} -result {{-1.79769313486232E+308 1\
System.ArgumentException} {-1 1 System.ArgumentException} {0 1\
System.ArgumentException} {1 1 System.ArgumentException} {1721425.5 0\
{0001-01-01 00:00:00Z}} {2451910.5 0 {2001-01-01 00:00:00Z}} {2456962 0\
{2014-10-31 12:00:00Z}} {5373484.49999998 0 {9999-12-31 23:59:59.998Z}}\
{5373484.49999999 0 {9999-12-31 23:59:59.999Z}} {1.79769313486232E+308 1\
System.ArgumentException}}}

###############################################################################























































runSQLiteTestEpilogue
runTestEpilogue







>







 







|
|







 







>












|
|
|
|



>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>


42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
..
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
..
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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
    set code [catch {
      object invoke System.Data.SQLite.SQLiteConvert ToJulianDay \
          $dateTimeValue
    } result]

    if {$code != 0} then {
      regexp -- {---> (.*?):} $result result result
      regexp -- {(System\..*?):} $result result result
    }

    lappend results [list [$dateTimeValue ToString [getDateTimeFormat]] \
        $code $result]
  }

  set results
................................................................................
###############################################################################

runTest {test tkt-3e783eecbe-1.2 {From Julian Day w/o OLE Automation} -setup {
  set minDoubleValue [object invoke -create -alias Double MinValue]
  set maxDoubleValue [object invoke -create -alias Double MaxValue]

  set doubleValues [list \
      $minDoubleValue -1.0 0.0 1.0 1721425.5 1757583.5 2451910.5 \
      2456962.0 5373484.49999998 5373484.49999999 $maxDoubleValue]
} -body {
  set results [list]

  foreach doubleValue $doubleValues {
    if {$doubleValue ni [info objects]} then {
      set doubleValue [object invoke \
          -create -alias Double Parse $doubleValue]
................................................................................
          System.Data.SQLite.SQLiteConvert ToDateTime $doubleValue Utc]

      $dateTimeValue ToString [getDateTimeFormat]
    } result]

    if {$code != 0} then {
      regexp -- {---> (.*?):} $result result result
      regexp -- {(System\..*?):} $result result result
    }

    lappend results [list [$doubleValue ToString] $code $result]
  }

  set results
} -cleanup {
  unset -nocomplain code result results dateTimeValue doubleValue \
      doubleValues maxDoubleValue minDoubleValue
} -constraints {eagle System.Data.SQLite} -result {{-1.79769313486232E+308 1\
System.ArgumentException} {-1 1 System.ArgumentException} {0 1\
System.ArgumentException} {1 1 System.ArgumentException} {1721425.5 0\
{0001-01-01 00:00:00Z}} {1757583.5 0 {0099-12-31 00:00:00Z}} {2451910.5 0\
{2001-01-01 00:00:00Z}} {2456962 0 {2014-10-31 12:00:00Z}} {5373484.49999998 0\
{9999-12-31 23:59:59.998Z}} {5373484.49999999 0 {9999-12-31 23:59:59.999Z}}\
{1.79769313486232E+308 1 System.ArgumentException}}}

###############################################################################

runTest {test tkt-3e783eecbe-1.3 {Julian Day storage} -setup {
  set doubleValues [list \
      -1.0 0.0 1.0 1721425.5 1757583.5 2451910.5 2456962.0 \
      5373484.49999998 5373484.49999999]

  setupDb [set fileName tkt-3e783eecbe-1.3.db] "" JulianDay
} -body {
  sql execute $db "CREATE TABLE t1(x INTEGER, y DATETIME);"

  set i 1
  set results [list]

  foreach doubleValue $doubleValues {
    if {$doubleValue ni [info objects]} then {
      set doubleValue [object invoke \
          -create -alias Double Parse $doubleValue]
    }

    set code [catch {
      sql execute $db "INSERT INTO t1 (x, y) VALUES(?, ?);" \
          [list param1 Int32 $i] [list param2 Double $doubleValue]

      sql execute -execute reader -format list -datetimeformat \
          [getDateTimeFormat] $db "SELECT y FROM t1 WHERE x = ?;" \
          [list param1 Int32 $i]
    } result]

    if {$code != 0} then {
      regexp -- {---> (.*?):} $result result result
      regexp -- {(System\..*?):} $result result result
    }

    lappend results [list [$doubleValue ToString] $code $result]
    incr i
  }

  set results
} -cleanup {
  unset -nocomplain code result results i dateTimeValue doubleValue \
      doubleValues maxDoubleValue minDoubleValue

  cleanupDb $fileName

  unset -nocomplain db fileName
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \
{{-1 1 System.ArgumentException} {0 1 System.ArgumentException} {1 1\
System.ArgumentException} {1721425.5 0 {{0001-01-01 00:00:00}}} {1757583.5 0\
{{0099-12-31 00:00:00}}} {2451910.5 0 {{2001-01-01 00:00:00}}} {2456962 0\
{{2014-10-31 12:00:00}}} {5373484.49999998 0 {{9999-12-31 23:59:59.998}}}\
{5373484.49999999 0 {{9999-12-31 23:59:59.999}}}}}

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue