System.Data.SQLite
Check-in [5d35df2f75]
Not logged in

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

Overview
Comment:Add initial test cases for ticket [01f20ea55a].
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | tkt-01f20ea55a
Files: files | file ages | folders
SHA1: 5d35df2f75c54d7446ba39da495e676447558724
User & Date: mistachkin 2016-10-10 20:58:16
Context
2016-10-10
21:37
Test case updates. Closed-Leaf check-in: cf56f17881 user: mistachkin tags: tkt-01f20ea55a
20:58
Add initial test cases for ticket [01f20ea55a]. check-in: 5d35df2f75 user: mistachkin tags: tkt-01f20ea55a
20:48
Enhance the 'getRowsFromDataTable' test suite helper procedure. check-in: cd91b8e6bf user: mistachkin tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Added Tests/tkt-01f20ea55a.eagle.

            1  +###############################################################################
            2  +#
            3  +# tkt-01f20ea55a.eagle --
            4  +#
            5  +# Written by Joe Mistachkin.
            6  +# Released to the public domain, use at your own risk!
            7  +#
            8  +###############################################################################
            9  +
           10  +package require Eagle
           11  +package require Eagle.Library
           12  +package require Eagle.Test
           13  +
           14  +runTestPrologue
           15  +
           16  +###############################################################################
           17  +
           18  +package require System.Data.SQLite.Test
           19  +runSQLiteTestPrologue
           20  +
           21  +###############################################################################
           22  +
           23  +set rawValue(0) "2016-10-01 12:34:56.8765401"
           24  +
           25  +###############################################################################
           26  +
           27  +set ticksValue(0) [getDateTimeTicks $rawValue(0)]
           28  +set ticksValue(1) [getDateTimeTicks $rawValue(0) false]
           29  +
           30  +###############################################################################
           31  +
           32  +set instanceValue(0) [object create -alias DateTime $ticksValue(0)]
           33  +set instanceValue(1) [object create -alias DateTime $ticksValue(1) Utc]
           34  +
           35  +###############################################################################
           36  +
           37  +set iso8601Value(0) [$instanceValue(0) ToString [getDateTimeFormat]]
           38  +set iso8601Value(1) [$instanceValue(1) ToString [getDateTimeFormat]]
           39  +
           40  +###############################################################################
           41  +
           42  +runTest {test tkt-01f20ea55a-1.1 {DateTimeKind with DataTable} -setup {
           43  +  proc dateTimeValueCallback { dataTable dataRow index value } {
           44  +    if {[object isoftype $value DateTime]} then {
           45  +      return [list [$value Kind] [$value ToString [getDateTimeFormat]]]
           46  +    } else {
           47  +      continue
           48  +    }
           49  +  }
           50  +
           51  +  setupDb [set fileName tkt-01f20ea55a-1.1.db] "" ISO8601 Utc
           52  +} -body {
           53  +  set connection [getDbConnection]
           54  +
           55  +  sql execute $db [subst {
           56  +    CREATE TABLE t1 (x, y DATETIME);
           57  +    INSERT INTO t1 (x, y) VALUES(1, NULL);
           58  +  }]
           59  +
           60  +  sql execute $db "INSERT INTO t1 (x, y) VALUES(2, ?);" \
           61  +      [list param1 DateTime $instanceValue(0)]
           62  +
           63  +  sql execute $db "INSERT INTO t1 (x, y) VALUES(3, ?);" \
           64  +      [list param1 DateTime $instanceValue(1)]
           65  +
           66  +  set command [$connection -alias CreateCommand]
           67  +  $command CommandText {SELECT x, y FROM t1 ORDER BY x;}
           68  +
           69  +  set dataAdapter [object create -alias \
           70  +      System.Data.SQLite.SQLiteDataAdapter $command]
           71  +
           72  +  set dataTable [object create -alias System.Data.DataTable]
           73  +
           74  +  $dataAdapter Fill $dataTable
           75  +  getRowsFromDataTable $dataTable dateTimeValueCallback
           76  +} -cleanup {
           77  +  unset -nocomplain dataTable dataAdapter command
           78  +
           79  +  freeDbConnection
           80  +
           81  +  cleanupDb $fileName
           82  +
           83  +  unset -nocomplain connection db fileName
           84  +
           85  +  rename dateTimeValueCallback ""
           86  +} -constraints {eagle command.object monoBug28 monoBug211 command.sql\
           87  +compile.DATA SQLite System.Data.SQLite} -result {{{x 1} y} {{x 2} {y\
           88  +{Unspecified {2016-10-01 12:34:56.8765401}}}} {{x 3} {y {Utc {2016-10-01\
           89  +12:34:56.8765401}}}}}}
           90  +
           91  +###############################################################################
           92  +
           93  +unset -nocomplain iso8601Value instanceValue ticksValue rawValue
           94  +
           95  +###############################################################################
           96  +
           97  +runSQLiteTestEpilogue
           98  +runTestEpilogue