Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gosqlite
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gosqlite
Commits
98b43ca9
Commit
98b43ca9
authored
Jan 08, 2012
by
gwenn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make sum test pass with the sqlite implementation.
parent
72be6aac
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
6 deletions
+5
-6
function_test.go
function_test.go
+5
-6
No files found.
function_test.go
View file @
98b43ca9
...
...
@@ -67,7 +67,7 @@ func TestRegexpFunction(t *testing.T) {
defer
db
.
Close
()
err
=
db
.
CreateScalarFunction
(
"regexp"
,
2
,
nil
,
re
,
reDestroy
)
checkNoError
(
t
,
err
,
"couldn't create function: %s"
)
s
,
err
:=
db
.
Prepare
(
"select regexp('l.s[aeiouy]', name) from (select 'lisa' as name union all select 'bart'
as name
)"
)
s
,
err
:=
db
.
Prepare
(
"select regexp('l.s[aeiouy]', name) from (select 'lisa' as name union all select 'bart')"
)
checkNoError
(
t
,
err
,
"couldn't prepare statement: %s"
)
defer
s
.
Finalize
()
if
b
:=
Must
(
s
.
Next
());
!
b
{
...
...
@@ -109,20 +109,19 @@ func sumFinal(ctx *Context) {
}
}
/*
func
TestSumFunction
(
t
*
testing
.
T
)
{
db
,
err
:=
Open
(
""
)
checkNoError
(
t
,
err
,
"couldn't open database file: %s"
)
defer
db
.
Close
()
err = db.CreateAggregateFunction("sum", 1, nil, sumStep, sumFinal, nil)
err
=
db
.
CreateAggregateFunction
(
"
my
sum"
,
1
,
nil
,
sumStep
,
sumFinal
,
nil
)
checkNoError
(
t
,
err
,
"couldn't create function: %s"
)
i, err := db.OneValue("select sum(i) from (select 2 as i union all select 2
as i
)")
i
,
err
:=
db
.
OneValue
(
"select sum(i) from (select 2 as i union all select 2)"
)
checkNoError
(
t
,
err
,
"couldn't execute statement: %s"
)
if i !=
4
{
if
i
!=
int64
(
4
)
{
t
.
Errorf
(
"Expected %d but got %d"
,
4
,
i
)
}
}
*/
func
randomFill
(
db
*
Conn
,
n
int
)
{
db
.
Exec
(
"DROP TABLE IF EXISTS test"
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment