mirror of
https://github.com/json-iterator/go.git
synced 2025-04-23 11:37:32 +02:00
24 lines
348 B
Go
24 lines
348 B
Go
package jsoniter
|
|
|
|
import (
|
|
"fmt"
|
|
"testing"
|
|
)
|
|
|
|
func Test_bind_api_demo(t *testing.T) {
|
|
iter := ParseString(`[0,1,2,3]`)
|
|
val := []int{}
|
|
iter.ReadVal(&val)
|
|
fmt.Println(val[3])
|
|
}
|
|
|
|
func Test_iterator_api_demo(t *testing.T) {
|
|
iter := ParseString(`[0,1,2,3]`)
|
|
total := 0
|
|
for iter.ReadArray() {
|
|
total += iter.ReadInt()
|
|
}
|
|
fmt.Println(total)
|
|
}
|
|
|