-
Notifications
You must be signed in to change notification settings - Fork 375
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Made some tests more robusts across platforms #1092
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,6 +47,10 @@ try { | |
verifyResult($result); | ||
|
||
// test not streamable types | ||
// The size of a float is platform dependent, with a precision of roughly 14 digits | ||
// http://php.net/manual/en/language.types.float.php | ||
// For example, the input value for column [real_type] in setup\test_types.sql is 1.18E-38 | ||
// but in some distros the fetched value is 1.1799999E-38 | ||
$tsql = "SELECT * FROM [test_types]"; | ||
$stmt = $conn->query($tsql); | ||
$result = $stmt->fetch(PDO::FETCH_NUM); | ||
|
@@ -60,19 +64,19 @@ unset($stmt); | |
unset($conn); | ||
|
||
?> | ||
--EXPECT-- | ||
--EXPECTREGEX-- | ||
Array | ||
( | ||
[0] => 9223372036854775807 | ||
[1] => 2147483647 | ||
[2] => 32767 | ||
[3] => 255 | ||
[4] => 1 | ||
[5] => 9999999999999999999999999999999999999 | ||
[6] => 922337203685477.5807 | ||
[7] => 214748.3647 | ||
[8] => 1.79E+308 | ||
[9] => 1.1799999E-38 | ||
[10] => 1968-12-12 16:20:00.000 | ||
[11] => | ||
) | ||
\( | ||
\[0\] => 9223372036854775807 | ||
\[1\] => 2147483647 | ||
\[2\] => 32767 | ||
\[3\] => 255 | ||
\[4\] => 1 | ||
\[5\] => 9999999999999999999999999999999999999 | ||
\[6\] => 922337203685477.5807 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the backslashes are needed here too (and in a few other places) to match a '.' |
||
\[7\] => 214748.3647 | ||
\[8\] => 1.79E\+308 | ||
\[9\] => (1.18E-38|1.1799999E-38) | ||
\[10\] => 1968-12-12 16:20:00.000 | ||
\[11\] => | ||
\) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -180,9 +180,9 @@ array(2) { | |
[5]=> | ||
string(10) "STRINGCOL2" | ||
["FloatCol"]=> | ||
string(18) "222.22200000000001" | ||
string(%d) "222.222%S" | ||
[6]=> | ||
string(18) "222.22200000000001" | ||
string(%d) "222.222%S" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just to clarify, this change in string length is because the value returned may have a different number of digits on different platforms, is that right? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes |
||
["XmlCol"]=> | ||
string(431) "<xml> 2 This is a really large string used to test certain large data types like xml data type. The length of this string is greater than 256 to correctly test a large data type. This is currently used by atleast varchar type and by xml type. The fetch tests are the primary consumer of this string to validate that fetch on large types work fine. The length of this string as counted in terms of number of characters is 417.</xml>" | ||
[7]=> | ||
|
@@ -395,7 +395,7 @@ object(stdClass)#%x (%x) { | |
["NVarCharCol"]=> | ||
string(10) "STRINGCOL2" | ||
["FloatCol"]=> | ||
string(18) "222.22200000000001" | ||
string(%d) "222.222%S" | ||
["XmlCol"]=> | ||
string(431) "<xml> 2 This is a really large string used to test certain large data types like xml data type. The length of this string is greater than 256 to correctly test a large data type. This is currently used by atleast varchar type and by xml type. The fetch tests are the primary consumer of this string to validate that fetch on large types work fine. The length of this string as counted in terms of number of characters is 417.</xml>" | ||
} | ||
|
@@ -414,7 +414,7 @@ array(8) { | |
[5]=> | ||
string(10) "STRINGCOL2" | ||
[6]=> | ||
string(18) "222.22200000000001" | ||
string(%d) "222.222%S" | ||
[7]=> | ||
string(431) "<xml> 2 This is a really large string used to test certain large data types like xml data type. The length of this string is greater than 256 to correctly test a large data type. This is currently used by atleast varchar type and by xml type. The fetch tests are the primary consumer of this string to validate that fetch on large types work fine. The length of this string as counted in terms of number of characters is 417.</xml>" | ||
} | ||
|
@@ -425,7 +425,7 @@ string(10) "STRINGCOL2" | |
string(23) "2000-11-11 11:11:11.223" | ||
string(10) "STRINGCOL2" | ||
string(10) "STRINGCOL2" | ||
string(18) "222.22200000000001" | ||
string(%d) "222.222%S" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There are other floating point values in this test's output, are you sure the other values are the same across different platforms? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So far, yes |
||
string(431) "<xml> 2 This is a really large string used to test certain large data types like xml data type. The length of this string is greater than 256 to correctly test a large data type. This is currently used by atleast varchar type and by xml type. The fetch tests are the primary consumer of this string to validate that fetch on large types work fine. The length of this string as counted in terms of number of characters is 417.</xml>" | ||
Test_9 : FETCH_INVALID : | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missed backslashes here?