コード例 #1
0
ファイル: main.go プロジェクト: pschlump/socketio
func main() {

	flag.Parse()
	fns := flag.Args()

	if len(fns) != 0 {
		fmt.Printf("Usage: Invalid arguments supplied, %s\n", fns)
		os.Exit(1)
	}

	var host_ip string = ""
	if *HostIP != "localhost" {
		host_ip = *HostIP
	}

	// Make certain that the command line parameters are handled correctly
	// fmt.Printf("host_ip >%s< HostIP >%s< Port >%s<\n", host_ip, *HostIP, *Port)

	server, err := socketio.NewServer(nil)
	if err != nil {
		log.Fatal(err)
	}

	server.On("connection", func(so socketio.Socket) {
		fmt.Printf("%sa user connected%s, %s\n", MiscLib.ColorGreen, MiscLib.ColorReset, godebug.LF())
		so.Join("chat")
		so.On("chat message", func(msg string) {
			fmt.Printf("%schat message, %s%s, %s\n", MiscLib.ColorGreen, msg, MiscLib.ColorReset, godebug.LF())
			so.BroadcastTo("chat", "chat message", msg)
		})
		so.On("disconnect", func() {
			fmt.Printf("%suser disconnect%s, %s\n", MiscLib.ColorYellow, MiscLib.ColorReset, godebug.LF())
		})
	})

	server.On("error", func(so socketio.Socket, err error) {
		fmt.Printf("Error: %s, %s\n", err, godebug.LF())
	})

	http.Handle("/socket.io/", server)
	http.Handle("/", http.FileServer(http.Dir(*Dir)))
	fmt.Printf("Serving on port %s, browse to http://localhost:%s/\n", *Port, *Port)
	listen := fmt.Sprintf("%s:%s", host_ip, *Port)
	log.Fatal(http.ListenAndServe(listen, nil))
}
コード例 #2
0
ファイル: ms.go プロジェクト: pschlump/ms
// ===================================================================================================================================================
func DoGet(client *http.Client, url string) string {
	r1, e0 := client.Get(url)
	if e0 != nil {
		fmt.Printf("Error!!!!!!!!!!! %v, %s\n", e0, tr.LF())
		return "Error"
	}
	rv, e1 := ioutil.ReadAll(r1.Body)
	if e1 != nil {
		fmt.Printf("Error!!!!!!!!!!! %v, %s\n", e1, tr.LF())
		return "Error"
	}
	r1.Body.Close()
	if string(rv[0:6]) == ")]}',\n" {
		rv = rv[6:]
	}

	return string(rv)
}
コード例 #3
0
ファイル: ms.go プロジェクト: pschlump/ms
// ===================================================================================================================================================
func DoPost(client *http.Client, Url string, s string) string {
	r1, e0 := client.PostForm(Url, url.Values{"auth_token": {s}})
	if e0 != nil {
		fmt.Printf("Error!!!!!!!!!!! %v, %s\n", e0, tr.LF())
		return "Error"
	}
	rv, e1 := ioutil.ReadAll(r1.Body)
	if e1 != nil {
		fmt.Printf("Error!!!!!!!!!!! %v, %s\n", e1, tr.LF())
		return "Error"
	}
	r1.Body.Close()
	if string(rv[0:6]) == ")]}',\n" {
		rv = rv[6:]
	}

	return string(rv)
}
コード例 #4
0
ファイル: main.go プロジェクト: pschlump/watch-cli
func doGet(client *http.Client, url string) string {
	r1, e0 := client.Get(url)
	if e0 != nil {
		fmt.Printf("Error!!!!!!!!!!! %v, %s\n", e0, godebug.LF())
		return "Error"
	}
	rv, e1 := ioutil.ReadAll(r1.Body)
	if e1 != nil {
		fmt.Printf("Error!!!!!!!!!!! %v, %s\n", e1, godebug.LF())
		return "Error"
	}
	r1.Body.Close()
	// fmt.Printf("Register New User Response: %s\n",string(rv))
	// fmt.Printf("Register New User Response 6: %s\n",string(rv[6:]))
	// Xyzzy - let's convert this to a func that deal with it.
	if string(rv[0:6]) == ")]}',\n" {
		rv = rv[6:]
	}

	return string(rv)
}
コード例 #5
0
ファイル: lexie_test.go プロジェクト: pschlump/lexie
func (s *Reader_TestSuite) TestLexie(c *C) {

	// return
	fmt.Fprintf(os.Stderr, "Test Matcher test from .json file, %s\n", tr.LF())

	dbOn["db_DumpDFAPool"] = true // DFA Dump Pool
	dbOn["db_DumpPool"] = true    // NFA Dump Pool
	dbOn["db_Matcher_02"] = true  // NFA Dump Pool

	lex := NewLexie()
	lex.ReadJSONSpec("./.json")

	if true {

		r := strings.NewReader("abcd{% simple {{ \u2022 }} stuff %} mOre")

		init := lex.DFA_Start["S_Init"]
		fmt.Printf("\n <> <> <> Machine Number: %d\n", init)
		dfa := lex.DFA_Machine[init]
		dfa.OutputInFormat(os.Stdout, "text")

		dfa.MatcherNewTab(r)

	} else {

		for ii, vv := range Lexie02Data {

			fmt.Printf("\n\nTest:%s ------------------------- Start --------------------------, %d, Input: -->>%s<<--\n", vv.Test, ii, vv.Inp)

			r := strings.NewReader(vv.Inp)
			lex.MatchInput2(r)

			fmt.Printf("Final Dump of TokenBuffer, Test:%s\n", vv.Test)
			lex.ATokList.DumpTokenBuffer()

			fmt.Printf("Test:%s ------------------------- End --------------------------\n\n", vv.Test)

		}

	}
}
コード例 #6
0
ファイル: handler.go プロジェクト: pschlump/socketio
func (h *socketHandler) onPacket(decoder *decoder, packet *packet) ([]interface{}, error) {
	if db1 {
		fmt.Printf("At:%s\n", godebug.LF())
	}
	var message string
	switch packet.Type {
	case _CONNECT:
		message = "connection"
	case _DISCONNECT:
		message = "disconnect"
	case _ERROR:
		message = "error"
	case _ACK:
	case _BINARY_ACK:
		return nil, h.onAck(packet.Id, decoder, packet)
	default:
		message = decoder.Message()
	}
	if db1 {
		fmt.Printf("At:%s\n", godebug.LF())
	}
	h.PrintEventsRespondedTo()
	if DbLogMessage {
		fmt.Printf("Message [%s] ", message)
		if db1 {
			fmt.Printf("%s\n", godebug.LF())
		}
	}

	/*
		// xyzzy - allEvents
		for _, c2 := range h.allEvents {
			args := c2.GetArgs() // returns Array of interface{}
			olen := len(args)
		}
	*/

	h.lock.RLock()
	c, ok := h.events[message]
	xc, ok1 := h.x_events[message]
	h.lock.RUnlock()

	if !ok && !ok1 {
		if db1 {
			fmt.Printf("Did not have a handler for %s At:%s\n", message, godebug.LF())
		}
		// If the message is not recognized by the server, the decoder.currentCloser
		// needs to be closed otherwise the server will be stuck until the e xyzzy
		fmt.Printf("Error: %s was not found in h.events\n", message)
		decoder.Close()
		return nil, nil
	}

	_ = xc
	/* New -----------------------------------------------------------------------------------------------------------------
	if ok1 {
		// type EventHandlerFunc func(so *Socket, message string, args [][]byte) error
		err, xargs, nargs := decoder.DecodeDataX(packet)
		if err != nil {
			fmt.Printf("Unable to decode packet, %s, %s\n", err, godebug.LF())
			return nil, err
		}
		err := xc(xyzzy, message, xargs, nargs)
		if err != nil {
			fmt.Printf("Handler reported an error: %s, message=%s\n", err, message, godebug.LF())
			return nil, err
		}
		return nil, nil

	}
	*/

	args := c.GetArgs() // returns Array of interface{}
	if db1 {
		fmt.Printf("len(args) = %d At:%s\n", len(args), godebug.LF())
	}
	olen := len(args)
	if db1 {
		fmt.Printf("args = %v, %s\n", args, godebug.LF())
	}
	if olen > 0 {
		packet.Data = &args
		if err := decoder.DecodeData(packet); err != nil {
			if db1 {
				fmt.Printf("At:%s, err=%s, an error at this point means that your handler did not get called\n", godebug.LF(), err)
			}
			fmt.Printf("Try a `map[string]interface{}` for a parameter type, %s\n", godebug.LF())
			return nil, err
		}
	}

	// Padd out args to olen
	for i := len(args); i < olen; i++ {
		args = append(args, nil)
	}

	if DbLogMessage {
		if db1 {
			fmt.Printf("\tArgs = %s, %s\n", godebug.SVar(args), godebug.LF())
		} else {
			fmt.Printf("Args = %s\n", godebug.SVar(args))
		}
	}
	if LogMessage {
		logrus.Infof("Message [%s] Auruments %s", message, godebug.SVar(args))
	}

	// ------------------------------------------------------ call ---------------------------------------------------------------------------------------
	retV := c.Call(h.socket, args)
	if len(retV) == 0 {
		if db1 {
			fmt.Printf("At:%s\n", godebug.LF())
		}
		return nil, nil
	}

	var err error
	if last, ok := retV[len(retV)-1].Interface().(error); ok {
		err = last
		retV = retV[0 : len(retV)-1]
	}
	ret := make([]interface{}, len(retV))
	for i, v := range retV {
		ret[i] = v.Interface()
	}
	if db1 {
		fmt.Printf("At:%s\n", godebug.LF())
	}
	if DbLogMessage {
		if err != nil {
			fmt.Printf("Response/Error %s", err)
		} else {
			fmt.Printf("Response %s", godebug.SVar(ret))
		}
	}
	if LogMessage {
		if err != nil {
			logrus.Infof("Response/Error %s", err)
		} else {
			logrus.Infof("Response %s", godebug.SVar(ret))
		}
	}
	return ret, err
}
コード例 #7
0
ファイル: main.go プロジェクト: pschlump/watch-cli
func main() {

	tmp1, err := flags.ParseArgs(&opts, os.Args)
	if err != nil {
		panic(err)
		os.Exit(1)
	}
	flist := tmp1[1:]

	// Get to the correct directory to run stuff from
	if opts.CdTo != "" {
		err := os.Chdir(opts.CdTo)
		if err != nil {
			fmt.Printf("Unable to change directories to %s, error: %s\n", opts.CdTo, err)
			os.Exit(1)
		}
	}

	var gCfg JSONCfg

	// Read in JSON config file if it exists
	if Exists(opts.Cfg) {
		fb, err := ioutil.ReadFile(opts.Cfg)
		if err != nil {
			fmt.Fprintf(os.Stderr, "Error reading config file %s, %s\n", opts.Cfg, err)
			os.Exit(1)
		}

		err = json.Unmarshal(fb, &gCfg)
		if err != nil {
			fmt.Fprintf(os.Stderr, "Error reading config file %s, %s - file did not parse\n", opts.Cfg, err)
			os.Exit(1)
		}

		fmt.Printf("Config file %s read in, watching %s\n", opts.Cfg, gCfg.FilesToWatch)

		flist = append(flist, gCfg.FilesToWatch...)
		if gCfg.CmdToRun != "" {
			opts.Cmd = gCfg.CmdToRun
		}
		if gCfg.CdTo != "" {
			opts.CdTo = gCfg.CdTo
		}
	}

	// setup signal handler to ignore some signals
	go handleSignals()

	// Delcare stuff --------------------------------------------------------------------------------------
	cli_buf := strings.Split(opts.Cmd, " ")

	// Do periodic Stuff ----------------------------------------------------------------------------------
	ticker := time.NewTicker(1 * time.Second)
	quit := make(chan struct{})
	go func() {
		for {
			// fmt.Printf("AT: %s\n", godebug.LF())
			select {
			case <-ticker.C:
				// do stuff
				if getClearRunCmd() {
					// setRunCmd(false)
					// fmt.Printf("AT: %s\n", godebug.LF())
					cmd := exec.Command(cli_buf[0], cli_buf[1:]...)
					// cmd.Stdin = strings.NewReader("some input")
					var out bytes.Buffer
					cmd.Stdout = &out
					err := cmd.Run()
					if err != nil {
						fmt.Printf("Run Errors: %s", err)
					}
					// fmt.Printf("AT: %s\n", godebug.LF())
					fmt.Printf("%s\n", out.String())
				}
			case <-quit:
				// fmt.Printf("AT: %s\n", godebug.LF())
				ticker.Stop()
				return
			}
		}
	}()

	// Watch file for changes -----------------------------------------------------------------------------
	watcher, err := fsnotify.NewWatcher()
	if err != nil {
		log.Fatal(err)
	}

	// fmt.Printf("AT: %s\n", godebug.LF())
	done := make(chan bool)

	// Process events
	go func() {
		for {
			// fmt.Printf("AT: %s\n", godebug.LF())
			select {
			case ev := <-watcher.Event:
				// fmt.Printf("AT: %s\n", godebug.LF())
				fmt.Printf("Event: %+v\n", ev) // log.Println("event:", ev)
				name := ev.Name
				isRen := ev.IsRename()
				fmt.Printf("Caught an event, %s\n", godebug.SVar(ev))

				setRunCmd(true)

				if isRen {
					err = watcher.Watch(name)
					if err != nil {
						fmt.Printf("Failed to set watch on %s, %s, -- will try again in 1/10 of second %s\n", name, err, godebug.LF())
						go func(watcher *fsnotify.Watcher, name string) {
							time.Sleep(100 * time.Millisecond)
							err := watcher.Watch(name)
							if err != nil {
								fmt.Printf("Failed to set watch on %s, %s, -- 2nd try%s\n", name, err, godebug.LF())
							} else {
								fmt.Printf("Success on 2nd try - watch on %s, %s\n", name, godebug.LF())
							}
						}(watcher, name)
					}

				}
			case err := <-watcher.Error:
				// fmt.Printf("AT: %s\n", godebug.LF())
				log.Println("error:", err)
			}
		}
		// fmt.Printf("AT: %s\n", godebug.LF())
	}()

	fmt.Printf("***************************************\n")
	fmt.Printf("* watching %s \n", flist)
	fmt.Printf("***************************************\n")
	for _, fn := range flist {
		// fmt.Printf("AT: %s\n", godebug.LF())
		if DirExists(fn) {
			var fns []string
			if !optsRecursive {
				fns, _ = GetFilenames(fn)
			} else {
				fns, _, _ = GetFilenamesRecrusive(fn)
			}
			for _, fn0 := range fns {
				err = watcher.Watch(fn0)
				if err != nil {
					fmt.Printf("Failed to set watch on %s, %s, %s\n", fn0, err, godebug.LF())
				}
			}
		} else {
			// fmt.Printf("AT: %s\n", godebug.LF())
			err = watcher.Watch(fn)
			if err != nil {
				fmt.Printf("Failed to set watch on %s, %s, %s\n", fn, err, godebug.LF())
			}
		}
		// fmt.Printf("AT: %s\n", godebug.LF())
	}
	// fmt.Printf("AT: %s\n", godebug.LF())

	<-done

	// fmt.Printf("AT: %s\n", godebug.LF())
	/* ... do stuff ... */
	watcher.Close()
}
コード例 #8
0
ファイル: lexie_test.go プロジェクト: pschlump/lexie
func (s *LexieTestSuite) TestLexie(c *C) {

	return
	fmt.Fprintf(os.Stderr, "Test Parsing of REs, %s\n", tr.LF())

	dbOn["db_NFA"] = true
	dbOn["db_NFA_LnNo"] = true
	dbOn["db_DumpPool"] = true
	dbOn["parseExpression"] = true
	dbOn["CalcLength"] = true

	// Add a test for any issue
	c.Check(42, Equals, 42)
	// c.Assert("nope", Matches, "hel.*there")
	fmt.Printf("**** In Test Issues\n")
	//x := test7GenDFA()
	//c.Check(x, Equals, 0)

	n_err := 0
	n_skip := 0

	for ii, vv := range Lexie01Data {
		fmt.Printf("\n\n--- %d Test: %s -----------------------------------------------------------------------------\n\n", ii, vv.Test)

		Pool := nfa.NewNFA_Pool()
		Cur := Pool.GetNFA()
		Pool.InitState = Cur

		Pool.AddReInfo(vv.Re, "", 1, vv.Rv, nfa.InfoType{})
		Pool.Sigma = Pool.GenerateSigma()

		if false {
			DbPrintf("test7", "Pool=%s\n", tr.SVarI(Pool))
		}
		Pool.DumpPool(false)
		Pool.DumpPoolJSON(os.Stdout, vv.Re, vv.Rv)

		fmt.Printf("Sigma: ->%s<-\n", Pool.Sigma)

		newFile := fmt.Sprintf("./ref/nfa_%s.tst", vv.Test)
		cmpFile := fmt.Sprintf("./ref/nfa_%s.ref", vv.Test)
		gvFile := fmt.Sprintf("./ref/nfa_%s.gv", vv.Test)
		svgFile := fmt.Sprintf("./ref/nfa_%s.svg", vv.Test)
		fp, _ := Fopen(newFile, "w")
		Pool.DumpPoolJSON(fp, vv.Re, vv.Rv)
		fp.Close()
		newData, err := ioutil.ReadFile(newFile)
		if err != nil {
			panic("unable to read file, " + cmpFile)
		}

		if sizlib.Exists(cmpFile) {
			ref, err := ioutil.ReadFile(cmpFile)
			if err != nil {
				panic("unable to read file, " + cmpFile)
			}
			if string(ref) != string(newData) {
				c.Check(string(newData), Equals, string(ref))
				fmt.Printf("%sError%s: Test case %s failed to match\n", Red, Reset, vv.Test)
				n_err++
			}
		} else {
			n_skip++
		}

		gv, _ := Fopen(gvFile, "w")
		Pool.GenerateGVFile(gv, vv.Re, vv.Rv)
		gv.Close()

		out, err = exec.Command("/usr/local/bin/dot", "-Tsvg", "-o"+svgFile, gvFile).Output()
		if err != nil {
			fmt.Printf("Error from dot, %s, %s\n", err, tr.LF())
			fmt.Printf("Output: %s\n", out)
		}
	}
	if n_skip > 0 {
		fmt.Fprintf(os.Stderr, "%sSkipped, # of files without automated checks = %d%s\n", Yellow, n_skip, Reset)
		DbPrintf("debug", "\n\n%sSkipped, # of files without automated checks = %d%s\n", Yellow, n_skip, Reset)
	}
	if n_err > 0 {
		fmt.Fprintf(os.Stderr, "%sFailed, # of errors = %d%s\n", Red, n_err, Reset)
		DbPrintf("debug", "\n\n%sFailed, # of errors = %d%s\n", Red, n_err, Reset)
	} else {
		fmt.Fprintf(os.Stderr, "%sPASS%s\n", Green, Reset)
		DbPrintf("debug", "\n\n%sPASS%s\n", Green, Reset)
	}
}
コード例 #9
0
ファイル: lexie_test.go プロジェクト: pschlump/lexie
func (s *NFA_to_DFA_TestSuite) TestLexie(c *C) {

	return
	fmt.Fprintf(os.Stderr, "Test NFA to DFA, %s\n", tr.LF())

	n_err := 0
	n_skip := 0

	dbOn["db_DFAGen"] = true
	dbOn["db_DumpDFAPool"] = true
	dbOn["db_DFA_LnNo"] = true

	// -----------------------------------------------------------------------------------------------------------------
	// -----------------------------------------------------------------------------------------------------------------
	// -----------------------------------------------------------------------------------------------------------------
	// vv := Lexie01Data[11]
	for ii, vv := range Lexie01Data {
		if !vv.SkipTest {
			// {Test: "0011", Re: `a(bcd)*(ghi)+(jkl)*X`, Rv: 1011},     //
			Nfa := nfa.NewNFA_Pool()
			Cur := Nfa.GetNFA()
			Nfa.InitState = Cur

			c.Log("\n\n--- %d NFA to DFA Test: %s -----------------------------------------------------------------------------\n\n", ii, vv.Test)
			fmt.Printf("\n\n--- %d NFA to DFA Test: %s -----------------------------------------------------------------------------\n\n", ii, vv.Test)
			newFile := fmt.Sprintf("./ref/dfa_%s.tst", vv.Test)
			cmpFile := fmt.Sprintf("./ref/dfa_%s.ref", vv.Test)
			gvFile := fmt.Sprintf("./ref/dfa_%s.gv", vv.Test)
			svgFile := fmt.Sprintf("./ref/dfa_%s.svg", vv.Test)
			tabFile := fmt.Sprintf("./ref/dfa_%s.tab", vv.Test)
			Nfa.AddReInfo(vv.Re, "", 1, vv.Rv, nfa.InfoType{})
			// Nfa.Sigma = Nfa.GenerateSigma()
			Nfa.Sigma = Nfa.GenerateSigma()
			fmt.Printf("\nSigma: ->%s<-\n", Nfa.Sigma)
			fmt.Printf("\n\nRe: %s\n", vv.Re)
			Nfa.DumpPool(false)

			Dfa := dfa.NewDFA_Pool()
			Dfa.ConvNDA_to_DFA(Nfa)

			fp, _ := Fopen(newFile, "w")
			Dfa.DumpPoolJSON(fp, vv.Re, vv.Rv)
			fp.Close()
			newData, err := ioutil.ReadFile(newFile)
			if err != nil {
				panic("unable to read file, " + cmpFile)
			}

			if sizlib.Exists(cmpFile) {
				ref, err := ioutil.ReadFile(cmpFile)
				if err != nil {
					panic("unable to read file, " + cmpFile)
				}
				if string(ref) != string(newData) {
					c.Check(string(newData), Equals, string(ref))
					fmt.Printf("%sError%s: Test case %s failed to match\n", Red, Reset, vv.Test)
					n_err++
				}
			} else {
				n_skip++
			}
			// -----------------------------------------------------------------------------------------------------------------
			// Post dump
			// -----------------------------------------------------------------------------------------------------------------
			fmt.Printf("----------------------------------------------------------------------------------------------------\n")
			fmt.Printf("Bottom .. machine is...\n")
			fmt.Printf("----------------------------------------------------------------------------------------------------\n")
			Dfa.DumpPool(false)

			// func (dfa *NFA_PoolType) GenerateGVFile(fo io.Writer, td string, tn int) {
			gv, _ := Fopen(gvFile, "w")
			Dfa.GenerateGVFile(gv, vv.Re, vv.Rv)
			gv.Close()

			tf, _ := Fopen(tabFile, "w")
			//Dfa.DumpPoolJSON(fp, vv.Re, vv.Rv)
			Dfa.OutputInFormat(tf, "text") // text, go-code, c-code, json, xml etc.
			tf.Close()

			out, err = exec.Command("/usr/local/bin/dot", "-Tsvg", "-o"+svgFile, gvFile).Output()
			if err != nil {
				fmt.Printf("Error from dot, %s, %s\n", err, tr.LF())
				fmt.Printf("Output: %s\n", out)
			}
		}
	}
	// -----------------------------------------------------------------------------------------------------------------
	// -----------------------------------------------------------------------------------------------------------------
	// -----------------------------------------------------------------------------------------------------------------

	if n_err > 0 {
		fmt.Fprintf(os.Stderr, "%sFailed, # of errors = %d%s\n", Red, n_err, Reset)
		DbPrintf("debug", "\n\n%sFailed, # of errors = %d%s\n", Red, n_err, Reset)
	} else {
		fmt.Fprintf(os.Stderr, "%sPASS%s\n", Green, Reset)
		DbPrintf("debug", "\n\n%sPASS%s\n", Green, Reset)
	}
}
コード例 #10
0
ファイル: lexie_test.go プロジェクト: pschlump/lexie
func (s *LambdaClosureTestSuite) TestLexie(c *C) {

	return
	fmt.Fprintf(os.Stderr, "Test NFA generation from REs, %s\n", tr.LF())

	n_err := 0

	dbOn["db_NFA"] = true
	dbOn["db_NFA_LnNo"] = true
	dbOn["db_DumpPool"] = true
	dbOn["parseExpression"] = true

	// {Test: "0011", Re: `a(bcd)*(ghi)+(jkl)*X`, Rv: 1011},     //
	Pool := nfa.NewNFA_Pool()
	Cur := Pool.GetNFA()
	Pool.InitState = Cur

	vv := Lexie01Data[11]
	Pool.AddReInfo(vv.Re, "", 1, vv.Rv, nfa.InfoType{})
	Pool.Sigma = Pool.GenerateSigma()
	fmt.Printf("\n\nRe: %s\n", vv.Re)
	Pool.DumpPool(false)

	// -------------------------------------- test 1 -----------------------------------
	r1 := Pool.LambdaClosure([]int{1})
	fmt.Printf("\n\nr1(1)=%v\n", r1)

	if len(com.CompareSlices([]int{4, 1, 5, 6}, r1)) != 0 {
		fmt.Printf("%sError%s: Test case 1 failed to match\n", Red, Reset)
		n_err++
	}
	// c.Check(r1, Equals, []int{4, 1, 5, 6})
	c.Check(len(com.CompareSlices([]int{4, 1, 5, 6}, r1)), Equals, 0)

	// -------------------------------------- test 2 -----------------------------------
	r2 := Pool.LambdaClosure([]int{5, 8, 11})
	fmt.Printf("\n\nr2(5,8,11)=%v\n", r2)

	if len(com.CompareSlices([]int{6}, r2)) != 0 {
		fmt.Printf("%sError%s: Test case 2 failed to match\n", Red, Reset)
		n_err++
	}
	// c.Check(r2, Equals, []int{5, 8, 11})
	c.Check(len(com.CompareSlices([]int{6}, r2)), Equals, 0)

	// -------------------------------------- test 3 -----------------------------------
	r3 := Pool.LambdaClosure([]int{9})
	fmt.Printf("\n\nr3(9)=%v\n", r3)

	if len(com.CompareSlices([]int{6, 10, 13, 10, 14}, r3)) != 0 {
		fmt.Printf("%sError%s: Test case 3 failed to match\n", Red, Reset)
		n_err++
	}
	// c.Check(r3, Equals, []int{5, 8, 11})
	c.Check(len(com.CompareSlices([]int{6, 10, 13, 10, 14}, r3)), Equals, 0)

	// ------------------------- understand test runner ---------------------------------------
	if false {
		c.Check(1, Equals, 0)
		// c.Assert(2, Equals, 0) // Failure of an assert ends test (exit)
		sss := c.GetTestLog()
		fp, err := Fopen(",g", "w")
		c.Check(err, Equals, nil)
		fmt.Fprintf(fp, "c.GetTestLog: ->%s<-\n", sss)
	}

	// ------------------------- eval results now ---------------------------------------

	if n_err > 0 {
		fmt.Fprintf(os.Stderr, "%sFailed, # of errors = %d%s\n", Red, n_err, Reset)
		DbPrintf("debug", "\n\n%sFailed, # of errors = %d%s\n", Red, n_err, Reset)
	} else {
		fmt.Fprintf(os.Stderr, "%sPASS%s\n", Green, Reset)
		DbPrintf("debug", "\n\n%sPASS%s\n", Green, Reset)
	}
}