go-study/cyclic_barrier/h2o_test.go
2023-12-23 14:33:52 +08:00

25 lines
420 B
Go

package cyclic_barrier
import (
"sort"
"testing"
)
func TestH2O(t *testing.T) {
h2o := NewH2O()
ch := h2o.Gen(10)
result := make([]string, 0, 10)
molecular := make([]string, 0, 3)
for c := range ch {
molecular = append(molecular, c)
if len(molecular) == 3 {
sort.Strings(molecular)
result = append(result, molecular[0]+molecular[1]+molecular[2])
molecular = molecular[:0]
}
}
t.Log(result)
}