package main import ( "tests/regressions/should_compile/iter_apis/lib" ) func main() { // Termination: a batch program must still be stoppable, so the entry // handles the channel the runtime closes on SIGINT/SIGTERM. select { case <-shutdown: return default: } if got := lib.SumSeq(7); got != 7 { panic("generic Seq[V] round trip = " | got.String() | ", want 7") } m := map[string]int32{"a": 1, "b": 2, "c": 3} if got := lib.SumValues(m); got != 6 { panic("maps.Values sum = " | got.String() | ", want 6") } if got := lib.CountPairs(m); got != 3 { panic("maps.All pairs = " | got.String() | ", want 3") } if got := lib.Keys(m); len(got) != 3 { panic("maps.Keys yielded " | int32(len(got)).String() | " keys, want 3") } seq := lib.Collect(lib.CounterSeq()) if len(seq) != 3 || seq[0] != 0 || seq[1] != 1 || seq[2] != 2 { panic("a hand-written iter.Seq did not collect to 0,1,2") } println("iterators ok") }