package main

import (
	"fmt"
	"log"
	"testing"
)

func Test_main(t *testing.T) {
	m1 := map[string]*[]string{}
	s := m1["dd"]
	log.Println("aaaaa1")
	func() {
		if s == nil {
			defer func() {
				log.Println("defer")
			}()
			s = &[]string{}
			m1["dd"] = s
			log.Println("aaa3")
		}
	}()
	n := 0
	for {
		defer func(n int) {
			log.Println("for", n)
		}(n)
		n++
		log.Println(n)
		if n > 2 {
			break
		}
	}
	log.Println("aaa2")
	*s = append(*s, "aa")
	log.Println("---m1[dd]:", m1["dd"])

	//arr := []string{"aa", "bb", "cc", "dd", "ee", "abdsfsdfsd"}
	//log.Println("二分查找", binarySearch(arr, "bb"))
}
func Test_3t2(t *testing.T) {
	pcb := [][]string{
		[]string{"A", "B"},
		[]string{"A", "B"},
		[]string{"A", "B"},
	}
	for _, v1 := range pcb[0] {
		tmp := []string{}
		for _, v2 := range pcb[1] {
			for _, v3 := range pcb[1] {
				key := fmt.Sprintf("%s%s%s", v1, v2, v3)
				tmp = append(tmp, key)
			}
		}
		log.Println(tmp)
	}

}
