###############################################################################
#
# tkt-00f86f9739.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################
package require Eagle
package require Eagle.Library
package require Eagle.Test
runTestPrologue
###############################################################################
package require System.Data.SQLite.Test
runSQLiteTestPrologue
###############################################################################
#
# NOTE: Setup the variables that refer to the various files required by the
# tests in this file.
#
set entityFrameworkDllFile [getBuildFileName EntityFramework.dll]
set systemDataSQLiteDllFile [getBuildFileName System.Data.SQLite.dll]
set systemDataSQLiteLinqDllFile [getBuildFileName System.Data.SQLite.Linq.dll]
set systemDataSQLiteEf6DllFile [getBuildFileName System.Data.SQLite.EF6.dll]
set testLinqExeFile [getBuildFileName testlinq.exe]
set testEf6ExeFile [getBuildFileName testef6.exe]
set northwindEfDbFile [file nativename [file join [file dirname $path] \
testlinq northwindEF.db]]
#
# NOTE: Setup the test constraints specific to the tests in this file.
#
if {![haveConstraint [appendArgs file_ \
[file tail $entityFrameworkDllFile]]]} then {
checkForFile $test_channel $entityFrameworkDllFile
}
if {![haveConstraint [appendArgs file_ \
[file tail $systemDataSQLiteDllFile]]]} then {
checkForFile $test_channel $systemDataSQLiteDllFile
}
if {![haveConstraint [appendArgs file_ \
[file tail $systemDataSQLiteLinqDllFile]]]} then {
checkForFile $test_channel $systemDataSQLiteLinqDllFile
}
if {![haveConstraint [appendArgs file_ \
[file tail $systemDataSQLiteEf6DllFile]]]} then {
checkForFile $test_channel $systemDataSQLiteEf6DllFile
}
if {![haveConstraint [appendArgs file_ [file tail $testLinqExeFile]]]} then {
checkForFile $test_channel $testLinqExeFile
}
if {![haveConstraint [appendArgs file_ [file tail $testEf6ExeFile]]]} then {
checkForFile $test_channel $testEf6ExeFile
}
if {![haveConstraint [appendArgs file_ [file tail $northwindEfDbFile]]]} then {
checkForFile $test_channel $northwindEfDbFile
}
###############################################################################
runTest {test tkt-00f86f9739-1.1 {LINQ with StartsWith} -body {
#
# NOTE: Re-copy the reference database file used for this unit test to the
# build directory in case it has been changed by a previous test run.
#
file copy -force $northwindEfDbFile \
[file join [getBuildDirectory] [file tail $northwindEfDbFile]]
set result [list]
foreach value [list "" a b z 1+1 don notthere] {
set output ""
set code [catch {
testClrExec $testLinqExeFile [list -eventflags Wait -directory \
[file dirname $testLinqExeFile] -nocarriagereturns -stdout output \
-success 0] -startsWith $value
} error]
tlog "---- BEGIN STDOUT OUTPUT\n"
tlog $output
tlog "\n---- END STDOUT OUTPUT\n"
lappend result $code
if {$code == 0} then {
lappend result [string trim $output]
} else {
lappend result [string trim $error]
}
}
set result
} -cleanup {
unset -nocomplain code output error result value
} -constraints \
{eagle monoToDo defineConstant.System.Data.SQLite.USE_INTEROP_DLL\
defineConstant.System.Data.SQLite.INTEROP_EXTENSION_FUNCTIONS SQLite testExec\
file_System.Data.SQLite.dll file_System.Data.SQLite.Linq.dll file_testlinq.exe\
file_northwindEF.db} -result {0 {} 0 {DRACD OLDWO RATTC} 0 {ALFKI CACTU CHOPS\
FOLKO GALED KOENE LILAS MAGAA MAISD OCEAN RANCH SAVEA THECR} 0 {} 0 {} 0 {} 0\
{}}}
###############################################################################
runTest {test tkt-00f86f9739-1.2 {EF6 with StartsWith} -body {
#
# NOTE: Re-copy the reference database file used for this unit test to the
# build directory in case it has been changed by a previous test run.
#
file copy -force $northwindEfDbFile \
[file join [getBuildDirectory] [file tail $northwindEfDbFile]]
set result [list]
foreach value [list "" a b z 1+1 don notthere] {
set output ""
set code [catch {
testClrExec $testEf6ExeFile [list -eventflags Wait -directory \
[file dirname $testEf6ExeFile] -nocarriagereturns -stdout output \
-success 0] -startsWith $value
} error]
tlog "---- BEGIN STDOUT OUTPUT\n"
tlog $output
tlog "\n---- END STDOUT OUTPUT\n"
lappend result $code
if {$code == 0} then {
lappend result [string trim $output]
} else {
lappend result [string trim $error]
}
}
set result
} -cleanup {
unset -nocomplain code output error result value
} -constraints \
{eagle monoToDo defineConstant.System.Data.SQLite.USE_INTEROP_DLL\
defineConstant.System.Data.SQLite.INTEROP_EXTENSION_FUNCTIONS SQLite testExec\
file_EntityFramework.dll file_System.Data.SQLite.dll\
file_System.Data.SQLite.EF6.dll file_testef6.exe file_northwindEF.db} -result \
{0 {} 0 {DRACD OLDWO RATTC} 0 {ALFKI CACTU CHOPS FOLKO GALED KOENE LILAS MAGAA\
MAISD OCEAN RANCH SAVEA THECR} 0 {} 0 {} 0 {} 0 {}}}
###############################################################################
unset -nocomplain northwindEfDbFile testEf6ExeFile testLinqExeFile \
systemDataSQLiteEf6DllFile systemDataSQLiteLinqDllFile \
systemDataSQLiteDllFile entityFrameworkDllFile
###############################################################################
runSQLiteTestEpilogue
runTestEpilogue