MCPcopy
hub / github.com/go-sql-driver/mysql / TestFloat64

Function TestFloat64

driver_test.go:569–591  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

567}
568
569func TestFloat64(t *testing.T) {
570 runTestsParallel(t, dsn, func(dbt *DBTest, tbl string) {
571 types := [2]string{"FLOAT", "DOUBLE"}
572 var expected float64 = 42.23
573 var out float64
574 var rows *sql.Rows
575 for _, v := range types {
576 dbt.mustExec("CREATE TABLE " + tbl + " (value " + v + ")")
577 dbt.mustExec("INSERT INTO " + tbl + " VALUES (42.23)")
578 rows = dbt.mustQuery("SELECT value FROM " + tbl)
579 if rows.Next() {
580 rows.Scan(&out)
581 if expected != out {
582 dbt.Errorf("%s: %g != %g", v, expected, out)
583 }
584 } else {
585 dbt.Errorf("%s: no data", v)
586 }
587 rows.Close()
588 dbt.mustExec("DROP TABLE IF EXISTS " + tbl)
589 }
590 })
591}
592
593func TestFloat64Placeholder(t *testing.T) {
594 runTestsParallel(t, dsn, func(dbt *DBTest, tbl string) {

Callers

nothing calls this directly

Calls 6

runTestsParallelFunction · 0.85
mustExecMethod · 0.80
mustQueryMethod · 0.80
ScanMethod · 0.80
NextMethod · 0.45
CloseMethod · 0.45

Tested by

no test coverage detected