mirror of
https://github.com/ncruces/go-sqlite3.git
synced 2026-01-12 05:59:14 +00:00
More tests.
This commit is contained in:
31
.github/coverage.html
vendored
31
.github/coverage.html
vendored
@@ -59,7 +59,7 @@
|
||||
|
||||
<option value="file1">github.com/ncruces/go-sqlite3/compile.go (54.5%)</option>
|
||||
|
||||
<option value="file2">github.com/ncruces/go-sqlite3/conn.go (73.9%)</option>
|
||||
<option value="file2">github.com/ncruces/go-sqlite3/conn.go (86.8%)</option>
|
||||
|
||||
<option value="file3">github.com/ncruces/go-sqlite3/error.go (54.5%)</option>
|
||||
|
||||
@@ -233,6 +233,7 @@ func compile() <span class="cov8" title="1">{
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"math"
|
||||
"strconv"
|
||||
|
||||
"github.com/tetratelabs/wazero"
|
||||
@@ -378,7 +379,7 @@ func (c *Conn) error(rc uint64) error <span class="cov8" title="1">{
|
||||
}
|
||||
|
||||
func (c *Conn) free(ptr uint32) <span class="cov8" title="1">{
|
||||
if ptr == 0 </span><span class="cov0" title="0">{
|
||||
if ptr == 0 </span><span class="cov8" title="1">{
|
||||
return
|
||||
}</span>
|
||||
<span class="cov8" title="1">_, err := c.api.free.Call(c.ctx, uint64(ptr))
|
||||
@@ -393,18 +394,18 @@ func (c *Conn) new(len uint32) uint32 <span class="cov8" title="1">{
|
||||
panic(err)</span>
|
||||
}
|
||||
<span class="cov8" title="1">ptr := uint32(r[0])
|
||||
if ptr == 0 || ptr >= c.memory.Size() </span><span class="cov0" title="0">{
|
||||
if ptr == 0 || ptr >= c.memory.Size() </span><span class="cov8" title="1">{
|
||||
panic(oomErr)</span>
|
||||
}
|
||||
<span class="cov8" title="1">return ptr</span>
|
||||
}
|
||||
|
||||
func (c *Conn) newBytes(s []byte) uint32 <span class="cov0" title="0">{
|
||||
if s == nil </span><span class="cov0" title="0">{
|
||||
func (c *Conn) newBytes(s []byte) uint32 <span class="cov8" title="1">{
|
||||
if s == nil </span><span class="cov8" title="1">{
|
||||
return 0
|
||||
}</span>
|
||||
|
||||
<span class="cov0" title="0">siz := uint32(len(s))
|
||||
<span class="cov8" title="1">siz := uint32(len(s))
|
||||
ptr := c.new(siz)
|
||||
mem, ok := c.memory.Read(ptr, siz)
|
||||
if !ok </span><span class="cov0" title="0">{
|
||||
@@ -412,7 +413,7 @@ func (c *Conn) newBytes(s []byte) uint32 <span class="cov0" title="0">{
|
||||
panic(rangeErr)</span>
|
||||
}
|
||||
|
||||
<span class="cov0" title="0">copy(mem, s)
|
||||
<span class="cov8" title="1">copy(mem, s)
|
||||
return ptr</span>
|
||||
}
|
||||
|
||||
@@ -435,17 +436,25 @@ func (c *Conn) getString(ptr, maxlen uint32) string <span class="cov8" title="1"
|
||||
}</span>
|
||||
|
||||
func getString(memory api.Memory, ptr, maxlen uint32) string <span class="cov8" title="1">{
|
||||
if ptr == 0 </span><span class="cov0" title="0">{
|
||||
if ptr == 0 </span><span class="cov8" title="1">{
|
||||
panic(nilErr)</span>
|
||||
}
|
||||
<span class="cov8" title="1">mem, ok := memory.Read(ptr, maxlen+1)
|
||||
if !ok </span><span class="cov0" title="0">{
|
||||
<span class="cov8" title="1">switch maxlen </span>{
|
||||
case 0:<span class="cov8" title="1">
|
||||
return ""</span>
|
||||
case math.MaxUint32:<span class="cov8" title="1"></span>
|
||||
//
|
||||
default:<span class="cov8" title="1">
|
||||
maxlen = maxlen + 1</span>
|
||||
}
|
||||
<span class="cov8" title="1">mem, ok := memory.Read(ptr, maxlen)
|
||||
if !ok </span><span class="cov8" title="1">{
|
||||
mem, ok = memory.Read(ptr, memory.Size()-ptr)
|
||||
if !ok </span><span class="cov0" title="0">{
|
||||
panic(rangeErr)</span>
|
||||
}
|
||||
}
|
||||
<span class="cov8" title="1">if i := bytes.IndexByte(mem, 0); i < 0 </span><span class="cov0" title="0">{
|
||||
<span class="cov8" title="1">if i := bytes.IndexByte(mem, 0); i < 0 </span><span class="cov8" title="1">{
|
||||
panic(noNulErr)</span>
|
||||
} else<span class="cov8" title="1"> {
|
||||
return string(mem[:i])
|
||||
|
||||
2
.github/coverage.svg
vendored
2
.github/coverage.svg
vendored
@@ -1 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="108" height="20" role="img" aria-label="coverage: 56.6%"><title>coverage: 56.6%</title><linearGradient id="s" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="r"><rect width="108" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#r)"><rect width="61" height="20" fill="#555"/><rect x="61" width="47" height="20" fill="#fe7d37"/><rect width="108" height="20" fill="url(#s)"/></g><g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110"><text aria-hidden="true" x="315" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="510">coverage</text><text x="315" y="140" transform="scale(.1)" fill="#fff" textLength="510">coverage</text><text aria-hidden="true" x="835" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="370">56.6%</text><text x="835" y="140" transform="scale(.1)" fill="#fff" textLength="370">56.6%</text></g></svg>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="108" height="20" role="img" aria-label="coverage: 59.0%"><title>coverage: 59.0%</title><linearGradient id="s" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="r"><rect width="108" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#r)"><rect width="61" height="20" fill="#555"/><rect x="61" width="47" height="20" fill="#fe7d37"/><rect width="108" height="20" fill="url(#s)"/></g><g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110"><text aria-hidden="true" x="315" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="510">coverage</text><text x="315" y="140" transform="scale(.1)" fill="#fff" textLength="510">coverage</text><text aria-hidden="true" x="835" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="370">59.0%</text><text x="835" y="140" transform="scale(.1)" fill="#fff" textLength="370">59.0%</text></g></svg>
|
||||
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Reference in New Issue
Block a user