Fork github.com/mattn/go-sqlite3 with adjustment for go1.16.2
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
534 B

  1. // +build sqlite_math_functions
  2. package sqlite3
  3. import (
  4. "database/sql"
  5. "testing"
  6. )
  7. func TestMathFunctions(t *testing.T) {
  8. db, err := sql.Open("sqlite3", ":memory:")
  9. if err != nil {
  10. t.Fatal("Failed to open database:", err)
  11. }
  12. defer db.Close()
  13. queries := []string{
  14. `SELECT acos(1)`,
  15. `SELECT log(10, 100)`,
  16. `SELECT power(2, 2)`,
  17. }
  18. for _, query := range queries {
  19. var result float64
  20. if err := db.QueryRow(query).Scan(&result); err != nil {
  21. t.Errorf("invoking math function query %q: %v", query, err)
  22. }
  23. }
  24. }