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

Golang gobot.Expect函数代码示例

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

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



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

示例1: TestButtonDriverActive

func TestButtonDriverActive(t *testing.T) {
	d := initTestButtonDriver()
	d.update(1)
	gobot.Expect(t, d.Active, true)

	d.update(0)
	gobot.Expect(t, d.Active, false)
}
开发者ID:heupel,项目名称:gobot,代码行数:8,代码来源:button_driver_test.go


示例2: TestLedDriverToggle

func TestLedDriverToggle(t *testing.T) {
	d := initTestLedDriver()
	d.Off()
	d.Toggle()
	gobot.Expect(t, d.IsOn(), true)
	d.Toggle()
	gobot.Expect(t, d.IsOff(), true)
}
开发者ID:heupel,项目名称:gobot,代码行数:8,代码来源:led_driver_test.go


示例3: TestFirmataAdaptorDigitalRead

func TestFirmataAdaptorDigitalRead(t *testing.T) {
	a := initTestFirmataAdaptor()
	// -1 on no data
	gobot.Expect(t, a.DigitalRead("1"), -1)

	pinNumber := "1"
	a.Board.Events = append(a.Board.Events, event{Name: fmt.Sprintf("digital_read_%v", pinNumber), Data: []byte{0x01}})
	gobot.Expect(t, a.DigitalRead(pinNumber), 0x01)
}
开发者ID:ninetwentyfour,项目名称:gobot,代码行数:9,代码来源:firmata_adaptor_test.go


示例4: TestMotorDriverIsOn

func TestMotorDriverIsOn(t *testing.T) {
	d := initTestMotorDriver()
	d.CurrentMode = "digital"
	d.CurrentState = 1
	gobot.Expect(t, d.IsOn(), true)
	d.CurrentMode = "analog"
	d.CurrentSpeed = 100
	gobot.Expect(t, d.IsOn(), true)
}
开发者ID:heupel,项目名称:gobot,代码行数:9,代码来源:motor_driver_test.go


示例5: TestPebbleDriverNotification

func TestPebbleDriverNotification(t *testing.T) {
	d := initTestPebbleDriver()
	d.SendNotification("Hello")
	d.SendNotification("World")

	gobot.Expect(t, d.Messages[0], "Hello")
	gobot.Expect(t, d.PendingMessage(), "Hello")
	gobot.Expect(t, d.PendingMessage(), "World")
	gobot.Expect(t, d.PendingMessage(), "")
}
开发者ID:kennylixi,项目名称:gobot,代码行数:10,代码来源:pebble_driver_test.go


示例6: TestFirmataAdaptorAnalogRead

func TestFirmataAdaptorAnalogRead(t *testing.T) {
	a := initTestFirmataAdaptor()
	// -1 on no data
	gobot.Expect(t, a.AnalogRead("1"), -1)

	pinNumber := "1"
	value := 133
	a.Board.Events = append(a.Board.Events, event{Name: fmt.Sprintf("analog_read_%v", pinNumber), Data: []byte{byte(value >> 24), byte(value >> 16), byte(value >> 8), byte(value & 0xff)}})
	gobot.Expect(t, a.AnalogRead(pinNumber), 133)
}
开发者ID:ninetwentyfour,项目名称:gobot,代码行数:10,代码来源:firmata_adaptor_test.go


示例7: TestMotorDriverOff

func TestMotorDriverOff(t *testing.T) {
	d := initTestMotorDriver()
	d.CurrentMode = "digital"
	d.Off()
	gobot.Expect(t, d.CurrentState, uint8(0))
	d.CurrentMode = "analog"
	d.CurrentSpeed = 100
	d.Off()
	gobot.Expect(t, d.CurrentSpeed, uint8(0))
}
开发者ID:heupel,项目名称:gobot,代码行数:10,代码来源:motor_driver_test.go


示例8: TestFirmataAdaptorI2cRead

func TestFirmataAdaptorI2cRead(t *testing.T) {
	a := initTestFirmataAdaptor()
	// [] on no data
	gobot.Expect(t, a.I2cRead(1), []byte{})

	i := []byte{100}
	i2cReply := map[string][]byte{}
	i2cReply["data"] = i
	a.Board.Events = append(a.Board.Events, event{Name: "i2c_reply", I2cReply: i2cReply})
	gobot.Expect(t, a.I2cRead(1), i)
}
开发者ID:ninetwentyfour,项目名称:gobot,代码行数:11,代码来源:firmata_adaptor_test.go


示例9: TestRobotDevices

func TestRobotDevices(t *testing.T) {
	a := initTestAPI()
	request, _ := http.NewRequest("GET", "/robots/Robot%201/devices", nil)
	response := httptest.NewRecorder()
	a.server.ServeHTTP(response, request)

	body, _ := ioutil.ReadAll(response.Body)
	var i []map[string]interface{}
	json.Unmarshal(body, &i)
	gobot.Expect(t, len(i), 3)
}
开发者ID:heupel,项目名称:gobot,代码行数:11,代码来源:api_test.go


示例10: TestRobotCommands

func TestRobotCommands(t *testing.T) {
	a := initTestAPI()
	request, _ := http.NewRequest("GET", "/robots/Robot%201/commands", nil)
	response := httptest.NewRecorder()
	a.server.ServeHTTP(response, request)

	body, _ := ioutil.ReadAll(response.Body)
	var i []string
	json.Unmarshal(body, &i)
	gobot.Expect(t, i, []string{"robotTestFunction"})
}
开发者ID:heupel,项目名称:gobot,代码行数:11,代码来源:api_test.go


示例11: TestRobot

func TestRobot(t *testing.T) {
	a := initTestAPI()
	request, _ := http.NewRequest("GET", "/robots/Robot%201", nil)
	response := httptest.NewRecorder()
	a.server.ServeHTTP(response, request)

	body, _ := ioutil.ReadAll(response.Body)
	var i map[string]interface{}
	json.Unmarshal(body, &i)
	gobot.Expect(t, i["name"].(string), "Robot 1")
}
开发者ID:heupel,项目名称:gobot,代码行数:11,代码来源:api_test.go


示例12: TestLeapMotionDriverParser

func TestLeapMotionDriverParser(t *testing.T) {
	d := initTestLeapMotionDriver()
	file, _ := ioutil.ReadFile("./test/support/example_frame.json")
	parsedFrame := d.ParseFrame(file)

	if parsedFrame.Hands == nil || parsedFrame.Pointables == nil || parsedFrame.Gestures == nil {
		t.Errorf("ParseFrame incorrectly parsed frame")
	}

	parsedFrame = d.ParseFrame([]byte{})
	gobot.Expect(t, parsedFrame.Timestamp, 0)
}
开发者ID:kennylixi,项目名称:gobot,代码行数:12,代码来源:leap_motion_driver_test.go


示例13: TestExecuteRobotDeviceCommand

func TestExecuteRobotDeviceCommand(t *testing.T) {
	a := initTestAPI()
	request, _ := http.NewRequest("GET", "/robots/Robot%201/devices/Device%201/commands/TestDriverCommand", bytes.NewBufferString(`{"name":"human"}`))
	request.Header.Add("Content-Type", "application/json")
	response := httptest.NewRecorder()
	a.server.ServeHTTP(response, request)

	body, _ := ioutil.ReadAll(response.Body)
	var i interface{}
	json.Unmarshal(body, &i)
	gobot.Expect(t, i, "hello human")
}
开发者ID:heupel,项目名称:gobot,代码行数:12,代码来源:api_test.go


示例14: TestUnknownRobotCommand

func TestUnknownRobotCommand(t *testing.T) {
	a := initTestAPI()
	request, _ := http.NewRequest("GET", "/robots/Robot%201/commands/robotTestFuntion1", bytes.NewBufferString(`{"message":"Beep Boop"}`))
	request.Header.Add("Content-Type", "application/json")
	response := httptest.NewRecorder()
	a.server.ServeHTTP(response, request)

	body, _ := ioutil.ReadAll(response.Body)
	var i interface{}
	json.Unmarshal(body, &i)
	gobot.Expect(t, i, "Unknown Command")
}
开发者ID:heupel,项目名称:gobot,代码行数:12,代码来源:api_test.go


示例15: TestConnect

func TestConnect(t *testing.T) {
	a := initTestArdroneAdaptor()
	gobot.Expect(t, a.Connect(), true)
}
开发者ID:heupel,项目名称:gobot,代码行数:4,代码来源:ardrone_adaptor_test.go


示例16: TestPebbleDriverHalt

func TestPebbleDriverHalt(t *testing.T) {
	d := initTestPebbleDriver()
	gobot.Expect(t, d.Halt(), true)
}
开发者ID:kennylixi,项目名称:gobot,代码行数:4,代码来源:pebble_driver_test.go


示例17: TestFinalize

func TestFinalize(t *testing.T) {
	a := initTestArdroneAdaptor()
	gobot.Expect(t, a.Finalize(), true)
}
开发者ID:heupel,项目名称:gobot,代码行数:4,代码来源:ardrone_adaptor_test.go


示例18: TestLedDriverOff

func TestLedDriverOff(t *testing.T) {
	d := initTestLedDriver()
	gobot.Expect(t, d.Off(), true)
	gobot.Expect(t, d.IsOff(), true)
}
开发者ID:heupel,项目名称:gobot,代码行数:5,代码来源:led_driver_test.go


示例19: TestLedDriverInit

func TestLedDriverInit(t *testing.T) {
	d := initTestLedDriver()
	gobot.Expect(t, d.Init(), true)
}
开发者ID:heupel,项目名称:gobot,代码行数:4,代码来源:led_driver_test.go


示例20: TestServoDriverCenter

func TestServoDriverCenter(t *testing.T) {
	d := initTestServoDriver()
	d.Center()
	gobot.Expect(t, d.CurrentAngle, uint8(90))
}
开发者ID:heupel,项目名称:gobot,代码行数:5,代码来源:servo_driver_test.go



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Golang gobot.FromScale函数代码示例发布时间:2022-05-28
下一篇:
Golang gobot.Every函数代码示例发布时间:2022-05-28
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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