• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Golang convey.Convey函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Golang中github.com/glycerine/goconvey/convey.Convey函数的典型用法代码示例。如果您正苦于以下问题:Golang Convey函数的具体用法?Golang Convey怎么用?Golang Convey使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了Convey函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。

示例1: TestCapnpWillCompileOurOutput

func TestCapnpWillCompileOurOutput(t *testing.T) {

	cv.Convey("Given a parsable golang source file with a simple struct", t, func() {
		cv.Convey("then when we generate capnp code, it should compile", func() {

			in1 := `
type in1 struct {
	Str string
	N   int
    D   float64
}`

			s1, err := ExtractFromString(in1)
			if err != nil {
				panic(err)
			}

			//expect1 := `struct In1 { str @0: Text; n @1: Int64; d @2: Float64; } `
			//cv.So(string(s1), cv.ShouldEqual, expect1)

			// no news on compile is good news
			_, err, x := CapnpCompileFragment(s1)
			cv.So(err, cv.ShouldEqual, nil)

			x.Cleanup()
		})
	})
}
开发者ID:robmurtha,项目名称:bambam,代码行数:28,代码来源:compile_test.go


示例2: TestReplicaJob

func TestReplicaJob(t *testing.T) {

	cv.Convey("If we start a job with a replication factor of 2", t, func() {
		cv.Convey("then the first job to finish should notify and cancel the other workers on that job", func() {
		})
	})
}
开发者ID:robmurtha,项目名称:goq,代码行数:7,代码来源:replicajob_test.go


示例3: TestEnvCannotContainKey

func TestEnvCannotContainKey(t *testing.T) {
	cv.Convey("To avoid transmitting the clusterid, the Env sent to the shepard/worker cannot contain COG_ variables or the clusterid", t, func() {
		cv.Convey("The 8 GOQ env var should all be subtracted by GetNonGOQEnv(), as well as any variable that has the specified cid in it", func() {

			// *** universal test cfg setup
			skipbye := false
			cfg := NewTestConfig()
			defer cfg.ByeTestConfig(&skipbye)
			// *** end universal test setup

			e := make(map[string]string)
			cfg.InjectConfigIntoMap(&e)

			e["UNTOUCHED"] = "sane"
			randomCid := RandomClusterId()
			e["SHALLNOTPASS"] = randomCid

			env2 := MapToEnv(e)

			cv.So(len(env2), cv.ShouldEqual, 11) // the 8 from cfg + UNTOUCHED and SHALLNOTPASS
			res := GetNonGOQEnv(env2, randomCid)

			cv.So(len(res), cv.ShouldEqual, 1)
			cv.So(res[0], cv.ShouldEqual, "UNTOUCHED=sane")
		})
	})
}
开发者ID:robmurtha,项目名称:goq,代码行数:27,代码来源:cfgenv_test.go


示例4: TestSubmitShutdownToLocalJobServ

func TestSubmitShutdownToLocalJobServ(t *testing.T) {

	cv.Convey("with a local jobserv, we should be able to submit a shutdown job to the server", t, func() {
		cv.Convey("and then server go routine should shut itself down cleanly", func() {

			// *** universal test cfg setup
			skipbye := false
			cfg := NewTestConfig()
			defer cfg.ByeTestConfig(&skipbye)
			// *** end universal test setup

			cfg.JservIP = ""
			jobserv, err := NewJobServ(cfg)
			if err != nil {
				panic(err)
			}
			defer CleanupOutdir(cfg)

			sub, err := NewLocalSubmitter(jobserv)
			if err != nil {
				panic(err)
			}
			sub.SubmitShutdownJob()

			<-jobserv.Done
			// we should get past the receive on Done when jobserv closes down:
			cv.So(true, cv.ShouldEqual, true)

		})
	})
}
开发者ID:robmurtha,项目名称:goq,代码行数:31,代码来源:fetch_test.go


示例5: TestTextAndTextListContaintingStruct

func TestTextAndTextListContaintingStruct(t *testing.T) {

	zjobBytes := CapnpEncode(`(cmd = "abc", args = ["xyz"])`, "Zjob")

	cv.Convey("Given a simple struct message Zjob containing a string (cmd='abc') and a list of string (args=['xyz'])", t, func() {
		cv.Convey("then the go-capnproto serialization should match the capnp c++ serialization", func() {

			seg := capn.NewBuffer(nil)
			zjob := air.NewRootZjob(seg)
			zjob.SetCmd("abc")
			tl := seg.NewTextList(1)
			tl.Set(0, "xyz")
			zjob.SetArgs(tl)

			buf := bytes.Buffer{}
			seg.WriteTo(&buf)

			act := buf.Bytes()
			fmt.Printf("          actual:\n")
			ShowBytes(act, 10)

			fmt.Printf("expected:\n")
			ShowBytes(zjobBytes, 10)

			cv.So(act, cv.ShouldResemble, zjobBytes)
		})
	})
}
开发者ID:hodduc,项目名称:go-capnproto,代码行数:28,代码来源:struct_test.go


示例6: Test004SingleSlice

func Test004SingleSlice(t *testing.T) {

	cv.Convey("Given a parsable golang source file with type Vector struct { M []int }", t, func() {
		cv.Convey("then we should generate translation utility methods for List(Int64) <-> []int in the capnp output", func() {

			ex0 := `
type Vector struct {
  M []int
}`
			cv.So(ExtractString2String(ex0), ShouldContainModuloWhiteSpace, `

func Int64ListToSliceInt(p capn.Int64List) []int {
	v := make([]int, p.Len())
	for i := range v {
		v[i] = int(p.At(i))
	}
	return v
}
`)

			cv.So(ExtractString2String(ex0), ShouldContainModuloWhiteSpace, `
func SliceIntToInt64List(seg *capn.Segment, m []int) capn.Int64List {
	lst := seg.NewInt64List(len(m))
	for i := range m {
		lst.Set(i, int64(m[i]))
	}
	return lst
}

`)
		})
	})
}
开发者ID:robmurtha,项目名称:bambam,代码行数:33,代码来源:singleslice_test.go


示例7: TestBitList

func TestBitList(t *testing.T) {
	seg, _ := zboolvec_value_FilledSegment(5, 3)
	text := CapnpDecodeSegment(seg, "", "aircraftlib/aircraft.capnp", "Z")

	expectedText := `(boolvec = [true, false, true])`

	cv.Convey("Given a go-capnproto created List(Bool) Z::boolvec with bool values [true, false, true]", t, func() {
		cv.Convey("When we decode it with capnp", func() {
			cv.Convey(fmt.Sprintf("Then we should get the expected text '%s'", expectedText), func() {
				cv.So(text, cv.ShouldEqual, expectedText)
			})
			cv.Convey("And our data should contain Z_BOOLVEC with contents true, false, true", func() {
				z := air.ReadRootZ(seg)
				cv.So(z.Which(), cv.ShouldEqual, air.Z_BOOLVEC)

				var bitlist = z.Boolvec()
				cv.So(bitlist.Len(), cv.ShouldEqual, 3)
				cv.So(bitlist.At(0), cv.ShouldEqual, true)
				cv.So(bitlist.At(1), cv.ShouldEqual, false)
				cv.So(bitlist.At(2), cv.ShouldEqual, true)
			})
		})
	})

}
开发者ID:hodduc,项目名称:go-capnproto,代码行数:25,代码来源:boollist_test.go


示例8: Test017WriteRead_StructPointerWithinStruct

func Test017WriteRead_StructPointerWithinStruct(t *testing.T) {

	tdir := NewTempDir()
	// comment the defer out to debug any rw test failures.
	defer tdir.Cleanup()

	err := exec.Command("cp", "rw3.go.txt", tdir.DirPath+"/rw3.go").Run()
	if err != nil {
		panic(err)
	}

	MainArgs([]string{os.Args[0], "-o", tdir.DirPath, "rw3.go.txt"})

	cv.Convey("Given bambam generated go bindings: with a struct pointer within a struct", t, func() {
		cv.Convey("then we should be able to write to disk, and read back the same structure", func() {
			cv.So(err, cv.ShouldEqual, nil)

			tdir.MoveTo()

			err = exec.Command("capnpc", "-ogo", "schema.capnp").Run()
			cv.So(err, cv.ShouldEqual, nil)

			err = exec.Command("go", "build").Run()
			cv.So(err, cv.ShouldEqual, nil)

			// run it
			err = exec.Command("./" + tdir.DirPath).Run()
			cv.So(err, cv.ShouldEqual, nil)

		})
	})
}
开发者ID:robmurtha,项目名称:bambam,代码行数:32,代码来源:rw3_test.go


示例9: TestDecodeOnKnownWellPackedData

func TestDecodeOnKnownWellPackedData(t *testing.T) {

	// length 17
	byteSliceIn := []byte{0x10, 0x5, 0x50, 0x2, 0x1, 0x1, 0x25, 0x0, 0x0, 0x11, 0x1, 0xc, 0xf, 0xd4, 0x7, 0xc, 0x7}
	fmt.Printf("len of byteSliceIn is %d\n", len(byteSliceIn))
	// annotated: byteSliceIn := []byte{tag:0x10, 0x5, tag:0x50, 0x2, 0x1, tag:0x1, 0x25, tag:0x0, 0x0, tag:0x11, 0x1, 0xc, tag:0xf, 0xd4, 0x7, 0xc, 0x7}

	// length 48
	expectedOut := []byte{0x0, 0x0, 0x0, 0x0, 0x5, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x2, 0x0, 0x1, 0x0, 0x25, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0xc, 0x0, 0x0, 0x0, 0xd4, 0x7, 0xc, 0x7, 0x0, 0x0, 0x0, 0x0}

	r := bytes.NewReader(byteSliceIn)
	actual, err := ioutil.ReadAll(capn.NewDecompressor(r))
	if err != nil {
		panic(err)
	}

	cv.Convey("Given a known-to-be-correctly packed 17-byte long sequence for a ZdateVector holding a single Zdate", t, func() {
		cv.Convey("When we use go-capnproto NewDecompressor", func() {
			cv.Convey("Then we should get the same unpacked bytes as capnp provides", func() {
				cv.So(len(actual), cv.ShouldResemble, len(expectedOut))
				cv.So(actual, cv.ShouldResemble, expectedOut)
			})
		})
	})

}
开发者ID:hodduc,项目名称:go-capnproto,代码行数:26,代码来源:stream_test.go


示例10: TestCreationOfZData

func TestCreationOfZData(t *testing.T) {
	const n = 20
	seg, _ := zdataFilledSegment(n)
	text := CapnpDecodeSegment(seg, "", "aircraftlib/aircraft.capnp", "Z")

	expectedText := `(zdata = (data = "\x00\x01\x02\x03\x04\x05\x06\a\b\t\n\v\f\r\x0e\x0f\x10\x11\x12\x13"))`

	cv.Convey("Given a go-capnproto created Zdata DATA element with n=20", t, func() {
		cv.Convey("When we decode it with capnp", func() {
			cv.Convey(fmt.Sprintf("Then we should get the expected text '%s'", expectedText), func() {
				cv.So(text, cv.ShouldEqual, expectedText)
			})
			cv.Convey("And our data should contain Z_ZDATA with contents 0,1,2,...,n", func() {
				z := air.ReadRootZ(seg)
				cv.So(z.Which(), cv.ShouldEqual, air.Z_ZDATA)

				var data []byte = z.Zdata().Data()
				cv.So(len(data), cv.ShouldEqual, n)
				for i := range data {
					cv.So(data[i], cv.ShouldEqual, i)
				}

			})
		})
	})

}
开发者ID:hodduc,项目名称:go-capnproto,代码行数:27,代码来源:create_test.go


示例11: TestWebGoesUpAndDown

func TestWebGoesUpAndDown(t *testing.T) {

	// *** universal test cfg setup
	skipbye := false
	cfg := NewTestConfig() // bumps cfg.TestportBump so cfg.GetWebPort() is different in test.
	defer cfg.ByeTestConfig(&skipbye)
	// *** end universal test setup

	s := NewWebServer()
	cv.Convey("NewWebServer() should bring up a debug web-server", t, func() {
		cv.So(PortIsBound(s.Addr), cv.ShouldEqual, true)
		by, err := FetchUrl("http://" + s.Addr + "/debug/pprof")
		cv.So(err, cv.ShouldEqual, nil)
		//fmt.Printf("by:'%s'\n", string(by))
		cv.So(strings.HasPrefix(string(by), `<html>
<head>
<title>/debug/pprof/</title>
</head>
/debug/pprof/<br>
<br>`), cv.ShouldEqual, true)

	})

	cv.Convey("WebServer::Stop() should bring down the debug web-server", t, func() {
		s.Stop()
		cv.So(PortIsBound(s.Addr), cv.ShouldEqual, false)
	})
}
开发者ID:robmurtha,项目名称:goq,代码行数:28,代码来源:web_test.go


示例12: TestDiffB

func TestDiffB(t *testing.T) {

	cv.Convey("Given two different (possibly long, differing in whitespace) strings a and b", t, func() {
		cv.Convey("then DiffB(a, b) should return the output of diff -b to consisely summarize their differences", func() {

			a := `
1
2
3
4
5
type   s1    struct {
  MyInts    []int
}`
			b := `
1
2
3
4
type s1 struct {
  MyInts []int
}`
			cv.So(string(Diffb(a, b)), cv.ShouldEqual, `6d5
< 5
`)

		})
	})
}
开发者ID:robmurtha,项目名称:bambam,代码行数:29,代码来源:diff_test.go


示例13: Test002ListListStructList

func Test002ListListStructList(t *testing.T) {

	cv.Convey("Given type RWTest struct { NestMatrix [][]Nester1; } in go, where Nester1 is a struct, and a mirror/parallel capnp struct air.RWTestCapn { nestMatrix @0: List(List(Nester1Capn)); } defined in the aircraftlib schema", t, func() {
		cv.Convey("When we Save() RWTest to capn and then Load() it back, the data should match, so that we have working List(List(Struct)) serialization and deserializatoin in go-capnproto", func() {

			// full RWTest
			rw := RWTest{
				NestMatrix: [][]Nester1{[]Nester1{Nester1{Strs: []string{"z", "w"}}, Nester1{Strs: []string{"q", "r"}}}, []Nester1{Nester1{Strs: []string{"zebra", "wally"}}, Nester1{Strs: []string{"qubert", "rocks"}}}},
			}

			var o bytes.Buffer
			rw.Save(&o)

			seg, n, err := capn.ReadFromMemoryZeroCopy(o.Bytes())
			cv.So(err, cv.ShouldEqual, nil)
			cv.So(n, cv.ShouldBeGreaterThan, 0)

			text := CapnpDecodeSegment(seg, "", "aircraftlib/aircraft.capnp", "RWTestCapn")

			if false {
				fmt.Printf("text = '%s'\n", text)
			}

			rw2 := &RWTest{}
			rw2.Load(&o)

			//fmt.Printf("rw = '%#v'\n", rw)
			//fmt.Printf("rw2 = '%#v'\n", rw2)

			same := reflect.DeepEqual(&rw, rw2)
			cv.So(same, cv.ShouldEqual, true)
		})
	})
}
开发者ID:hodduc,项目名称:go-capnproto,代码行数:34,代码来源:nested_test.go


示例14: Test001StructList

// start with smaller Struct(List)
func Test001StructList(t *testing.T) {

	cv.Convey("Given type Nester1 struct { Strs []string } in go, where Nester1 is a struct, and a mirror/parallel capnp struct air.Nester1Capn { strs @0: List(Text); } defined in the aircraftlib schema", t, func() {
		cv.Convey("When we Save() Nester to capn and then Load() it back, the data should match, so that we have working Struct(List) serialization and deserializatoin in go-capnproto", func() {

			// Does Nester1 alone serialization and deser okay?
			rw := Nester1{Strs: []string{"xenophilia", "watchowski"}}

			var o bytes.Buffer
			rw.Save(&o)

			seg, n, err := capn.ReadFromMemoryZeroCopy(o.Bytes())
			cv.So(err, cv.ShouldEqual, nil)
			cv.So(n, cv.ShouldBeGreaterThan, 0)

			text := CapnpDecodeSegment(seg, "", "aircraftlib/aircraft.capnp", "Nester1Capn")
			if false {
				fmt.Printf("text = '%s'\n", text)
			}
			rw2 := &Nester1{}
			rw2.Load(&o)

			//fmt.Printf("rw = '%#v'\n", rw)
			//fmt.Printf("rw2 = '%#v'\n", rw2)

			same := reflect.DeepEqual(&rw, rw2)
			cv.So(same, cv.ShouldEqual, true)
		})
	})
}
开发者ID:hodduc,项目名称:go-capnproto,代码行数:31,代码来源:nested_test.go


示例15: TestTextContaintingStruct

func TestTextContaintingStruct(t *testing.T) {

	zjobBytes := CapnpEncode(`(cmd = "abc")`, "Zjob")

	cv.Convey("Given a simple struct message Zjob containing a string 'abc' and a list of string (empty)", t, func() {
		cv.Convey("then the go-capnproto serialization should match the capnp c++ serialization", func() {

			seg := capn.NewBuffer(nil)
			zjob := air.NewRootZjob(seg)
			zjob.SetCmd("abc")

			buf := bytes.Buffer{}
			seg.WriteTo(&buf)

			act := buf.Bytes()
			fmt.Printf("          actual:\n")
			ShowBytes(act, 10)

			fmt.Printf("\n\n          expected:\n")
			ShowBytes(zjobBytes, 10)

			cv.So(act, cv.ShouldResemble, zjobBytes)
		})
	})
}
开发者ID:hodduc,项目名称:go-capnproto,代码行数:25,代码来源:struct_test.go


示例16: TestWriteBitListTwo64BitWords

func TestWriteBitListTwo64BitWords(t *testing.T) {

	seg := capn.NewBuffer(nil)
	z := air.NewRootZ(seg)
	list := seg.NewBitList(66)
	list.Set(64, true)
	list.Set(65, true)

	z.SetBoolvec(list)

	buf := bytes.Buffer{}
	seg.WriteTo(&buf)

	cv.Convey("Given a go-capnproto created List(Bool) Z::boolvec with bool values [true (+ 64 more times)]", t, func() {
		cv.Convey("Decoding it with c++ capnp should yield the expected text", func() {
			cv.So(CapnpDecodeSegment(seg, "", "aircraftlib/aircraft.capnp", "Z"), cv.ShouldEqual, `(boolvec = [false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, true, true])`)
		})
	})

	cv.Convey("And we should be able to read back what we wrote", t, func() {
		z := air.ReadRootZ(seg)
		cv.So(z.Which(), cv.ShouldEqual, air.Z_BOOLVEC)

		var bitlist = z.Boolvec()
		cv.So(bitlist.Len(), cv.ShouldEqual, 66)

		for i := 0; i < 64; i++ {
			cv.So(bitlist.At(i), cv.ShouldEqual, false)
		}
		cv.So(bitlist.At(64), cv.ShouldEqual, true)
		cv.So(bitlist.At(65), cv.ShouldEqual, true)
	})
}
开发者ID:hodduc,项目名称:go-capnproto,代码行数:33,代码来源:boollist_test.go


示例17: TestWorkerSubmitPortAllocation

func TestWorkerSubmitPortAllocation(t *testing.T) {

	cv.Convey("qzub submit and workers should allocate their own port numbers to avoid conflicts", t, func() {
		cv.Convey(" so that we can run lots of workers and submits on the same machine if need be", func() {

		})
	})
}
开发者ID:robmurtha,项目名称:goq,代码行数:8,代码来源:portreq_test.go


示例18: TestUnMarshal

func TestUnMarshal(t *testing.T) {

	cv.Convey("Given go structs", t, func() {
		cv.Convey("then the generated Unmarshal() code should copy from the capnp into the go structs", func() {

		})
	})
}
开发者ID:robmurtha,项目名称:bambam,代码行数:8,代码来源:marshal_test.go


示例19: TestObjectWithListOfTextBetweenSegments

func TestObjectWithListOfTextBetweenSegments(t *testing.T) {

	exp := CapnpEncode(`(counter = (size = 9, wordlist = ["hello","bye"]))`, "Bag")

	cv.Convey("Given an Counter in one segment and a Bag with text in another", t, func() {
		cv.Convey("we should be able to copy from one segment to the other with SetCounter() on a Bag", func() {

			seg := capn.NewBuffer(nil)
			scratch := capn.NewBuffer(nil)

			// in seg
			segbag := air.NewRootBag(seg)

			// in scratch
			xc := air.NewRootCounter(scratch)
			xc.SetSize(9)
			tl := scratch.NewTextList(2)
			tl.Set(0, "hello")
			tl.Set(1, "bye")
			xc.SetWordlist(tl)

			xbuf := bytes.Buffer{}
			scratch.WriteTo(&xbuf)

			x := xbuf.Bytes()
			save(x, "myscratch")
			fmt.Printf("scratch segment (%p):\n", scratch)
			ShowBytes(x, 10)
			fmt.Printf("scratch segment (%p) with Counter decoded by capnp: '%s'\n", scratch, string(CapnpDecode(x, "Counter")))

			prebuf := bytes.Buffer{}
			seg.WriteTo(&prebuf)
			fmt.Printf("Bag only segment seg (%p), pre-transfer:\n", seg)
			ShowBytes(prebuf.Bytes(), 10)

			// now for the actual test:
			// copy from scratch to seg
			segbag.SetCounter(xc)

			buf := bytes.Buffer{}
			seg.WriteTo(&buf)

			act := buf.Bytes()
			save(act, "myact")
			save(exp, "myexp")

			fmt.Printf("expected:\n")
			ShowBytes(exp, 10)
			fmt.Printf("exp decoded by capnp: '%s'\n", string(CapnpDecode(exp, "Bag")))

			fmt.Printf("          actual:\n")
			ShowBytes(act, 10)
			fmt.Printf("act decoded by capnp: '%s'\n", string(CapnpDecode(act, "Bag")))

			cv.So(act, cv.ShouldResemble, exp)
		})
	})
}
开发者ID:hodduc,项目名称:go-capnproto,代码行数:58,代码来源:struct_test.go


示例20: TestDataVersioningZeroPointersToMore

func TestDataVersioningZeroPointersToMore(t *testing.T) {

	expEmpty := CapnpEncode("(mylist = [(),()])", "HoldsVerEmptyList")

	cv.Convey("Given a struct with 0 ptr fields, and a newer version of the struct with 1-2 pointer fields", t, func() {
		cv.Convey("then serializing the empty list and reading it back into 1 or 2 pointer fields should default initialize the pointer fields", func() {

			seg := capn.NewBuffer(nil)
			scratch := capn.NewBuffer(nil)

			emptyholder := air.NewRootHoldsVerEmptyList(seg)
			elist := air.NewVerEmptyList(scratch, 2)
			emptyholder.SetMylist(elist)

			actEmpty := ShowSeg("          after NewRootHoldsVerEmptyList(seg) and SetMylist(elist), segment seg is:", seg)
			actEmptyCap := string(CapnpDecode(actEmpty, "HoldsVerEmptyList"))
			expEmptyCap := string(CapnpDecode(expEmpty, "HoldsVerEmptyList"))
			cv.So(actEmptyCap, cv.ShouldResemble, expEmptyCap)

			fmt.Printf("\n actEmpty is \n")
			ShowBytes(actEmpty, 10)
			fmt.Printf("actEmpty decoded by capnp: '%s'\n", string(CapnpDecode(actEmpty, "HoldsVerEmptyList")))
			cv.So(actEmpty, cv.ShouldResemble, expEmpty)

			// seg is set, now read into bigger list
			buf := bytes.Buffer{}
			seg.WriteTo(&buf)
			segbytes := buf.Bytes()

			reseg, _, err := capn.ReadFromMemoryZeroCopy(segbytes)
			if err != nil {
				panic(err)
			}
			ShowSeg("      after re-reading segbytes, segment reseg is:", reseg)
			fmt.Printf("segbytes decoded by capnp as HoldsVerOneDataList: '%s'\n", string(CapnpDecode(segbytes, "HoldsVerOneDataList")))

			reHolder := air.ReadRootHoldsVerTwoTwoList(reseg)
			list22 := reHolder.Mylist()
			len22 := list22.Len()
			cv.So(len22, cv.ShouldEqual, 2)
			for i := 0; i < 2; i++ {
				ele := list22.At(i)
				val := ele.Val()
				cv.So(val, cv.ShouldEqual, 0)
				duo := ele.Duo()
				cv.So(duo, cv.ShouldEqual, 0)
				ptr1 := ele.Ptr1()
				ptr2 := ele.Ptr2()
				fmt.Printf("ptr1 = %#v\n", ptr1)
				cv.So(ptr1.Segment, cv.ShouldEqual, nil)
				fmt.Printf("ptr2 = %#v\n", ptr2)
				cv.So(ptr2.Segment, cv.ShouldEqual, nil)
			}

		})
	})
}
开发者ID:hodduc,项目名称:go-capnproto,代码行数:57,代码来源:version_test.go



注:本文中的github.com/glycerine/goconvey/convey.Convey函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang convey.So函数代码示例发布时间:2022-05-23
下一篇:
Golang go-capnproto.Segment类代码示例发布时间:2022-05-23
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap