コード例 #1
0
ファイル: genomeTests.go プロジェクト: ericfode/Datazome
func NewGenomeTest() {
	//runtime.GOMAXPROCS(2)
	genomeFile, _ := os.Open("test.genome", os.O_CREATE^os.O_RDWR, 0666)
	indexFile, _ := os.Open("testIndex.genome", os.O_CREATE^os.O_RDWR, 0666)

	//genomeFile, _ := os.Open("test.genome", os.O_RDWR, 0666)
	//indexFile, _ := os.Open("testIndex.genome",os.O_RDWR, 0666)
	trainer := trainers.NewBruteTreeTrainer()
	genomeTrainer := genome.Trainer(trainer)

	genomeP, _ := genome.NewGenome(io.ReadWriteSeeker(genomeFile),
		io.ReadWriteSeeker(indexFile),
		genome.IndexerFunc(indexers.SmallIndexer),
		genomeTrainer,
		genome.FinderFunc(finders.HashFinder),
		genome.AdderFunc(adders.AppendAdder))
	err := genomeP.TrainOnDir("/usr/bin/")
	if err != nil {
		print(err.String())
	}
	genomeP.SaveGenome()
	//blender, _ := os.Open("/home/eric/win/PandoraFox/MP3/Strangefinger/Into The Blue/Strangefinger - Sleep (Radio Edit).mp3", os.O_RDONLY, 0666)
	//blenderTest, _ := os.Open("test.mp3", os.O_CREATE^os.O_RDWR, 0666)
	//tegeneFile, _ := os.Open("testTgene", os.O_CREATE^os.O_RDWR, 0666)
	//tGene, _ := genomeP.NewTGene(blender, "blender")
	//tGene.Save(tegeneFile)
	//tGene := genome.LoadTGene(tegeneFile)
	//data, _ := genomeP.RecreateData(*tGene)
	//blenderTest.Write(data)
	//blenderTest.Close()
}
コード例 #2
0
ファイル: issue15528.go プロジェクト: achanda/go
func makeRWS() io.ReadWriteSeeker { return &RWS{} }
func makeStringer() fmt.Stringer  { return &RWS{} }

// Test correct construction of static empty interface values
var efaces = [...]struct {
	x interface{}
	s string
}{
	{nil, "<nil> <nil>"},
	{1, "int 1"},
	{int(1), "int 1"},
	{Int(int(2)), "main.Int Int=2"},
	{int(Int(3)), "int 3"},
	{[1]int{2}, "[1]int [2]"},
	{io.Reader(io.ReadWriter(io.ReadWriteSeeker(nil))), "<nil> <nil>"},
	{io.Reader(io.ReadWriter(io.ReadWriteSeeker(&RWS{}))), "*main.RWS rws"},
	{makeRWS(), "*main.RWS rws"},
	{map[string]string{"here": "there"}, "map[string]string map[here:there]"},
	{chan bool(nil), "chan bool <nil>"},
	{unsafe.Pointer(uintptr(0)), "unsafe.Pointer <nil>"},
	{(*byte)(nil), "*uint8 <nil>"},
	{io.Writer((*os.File)(nil)), "*os.File <nil>"},
	{(interface{})(io.Writer((*os.File)(nil))), "*os.File <nil>"},
	{fmt.Stringer(Strunger(((*Int)(nil)))), "*main.Int <nil>"},
}

type Int int

func (i Int) String() string { return fmt.Sprintf("Int=%d", i) }
func (i Int) Strung()        {}