func TestToFromSqlite(t *testing.T) { r, _ := adn.GetGlobal() res, err := ToFromSqlite(r, "data/blog_test.db") if len(res) == 0 || err != nil { t.Error("Expected result, got nil") } if len(r.Data) != len(res) { t.Error("Returned ADN results and persistence store returned aren't the same", len(r.Data), len(res)) } }
func main() { rchan := make(chan adn.Response) go func() { r, err := adn.GetGlobal() check_error_status(err) rchan <- r }() go func() { r := <-rchan results, err := ToFromSqlite(r, file) check_error_status(err) for _, v := range results { fmt.Printf("%s\n", v) } }() fmt.Printf("Press any key to continue...") var input string fmt.Scanln(&input) }
func TestGlobalData(t *testing.T) { r, _ := adn.GetGlobal() if r.Meta.Code != 200 { t.Error("Expected 200, got ", r.Meta.Code) } }