forked from denisenkom/go-mssqldb
-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move optimized ucs22str function to 64bit only (#43)
* separate non-32-bit-compatible code * omit -race on 32bit build
- Loading branch information
1 parent
c33ed63
commit 63479d5
Showing
7 changed files
with
227 additions
and
184 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
//go:build go1.9 | ||
// +build go1.9 | ||
//go:build go1.9 && !386 | ||
// +build go1.9,!386 | ||
|
||
package mssql | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package mssql | ||
|
||
import ( | ||
"fmt" | ||
"testing" | ||
"time" | ||
) | ||
|
||
func TestDateTimeParam19(t *testing.T) { | ||
conn, logger := open(t) | ||
defer conn.Close() | ||
logger.StopLogging() | ||
|
||
// testing DateTime1, only supported on go 1.9 | ||
var emptydate time.Time | ||
mindate1 := time.Date(1753, 1, 1, 0, 0, 0, 0, time.UTC) | ||
maxdate1 := time.Date(9999, 12, 31, 23, 59, 59, 997000000, time.UTC) | ||
testdates1 := []DateTime1{ | ||
DateTime1(mindate1), | ||
DateTime1(maxdate1), | ||
DateTime1(time.Date(1752, 12, 31, 23, 59, 59, 997000000, time.UTC)), // just a little below minimum date | ||
DateTime1(time.Date(10000, 1, 1, 0, 0, 0, 0, time.UTC)), // just a little over maximum date | ||
DateTime1(emptydate), | ||
} | ||
|
||
for _, test := range testdates1 { | ||
t.Run(fmt.Sprintf("Test datetime for %v", test), func(t *testing.T) { | ||
var res time.Time | ||
expected := time.Time(test) | ||
queryParamRoundTrip(conn, test, &res) | ||
// clip value | ||
if expected.Before(mindate1) { | ||
expected = mindate1 | ||
} | ||
if expected.After(maxdate1) { | ||
expected = maxdate1 | ||
} | ||
if expected.Sub(res) != 0 { | ||
t.Errorf("expected: '%s', got: '%s' delta: %d", expected, res, expected.Sub(res)) | ||
} | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.