当前位置: 首页>>代码示例>>Golang>>正文


Golang gobottest.Refute函数代码示例

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


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

示例1: TestUtils

func TestUtils(t *testing.T) {
	_, currentfile, _, _ := runtime.Caller(0)
	image := cv.LoadImage(path.Join(path.Dir(currentfile), "lena-256x256.jpg"))
	rect := DetectFaces("haarcascade_frontalface_alt.xml", image)
	gobottest.Refute(t, len(rect), 0)
	gobottest.Refute(t, DrawRectangles(image, rect, 0, 0, 0, 0), nil)
}
开发者ID:hybridgroup,项目名称:gobot,代码行数:7,代码来源:utils_test.go

示例2: TestMcp

func TestMcp(t *testing.T) {
	a := initTestAPI()
	request, _ := http.NewRequest("GET", "/api/", nil)
	response := httptest.NewRecorder()
	a.ServeHTTP(response, request)

	var body map[string]interface{}
	json.NewDecoder(response.Body).Decode(&body)
	gobottest.Refute(t, body["MCP"].(map[string]interface{})["robots"], nil)
	gobottest.Refute(t, body["MCP"].(map[string]interface{})["commands"], nil)
}
开发者ID:hybridgroup,项目名称:gobot,代码行数:11,代码来源:api_test.go

示例3: TestDirectPinDriverPwmWrite

func TestDirectPinDriverPwmWrite(t *testing.T) {
	d := initTestDirectPinDriver(newGpioTestAdaptor())
	gobottest.Refute(t, d.PwmWrite(1), nil)

	d = initTestDirectPinDriver(&gpioTestBareAdaptor{})
	gobottest.Assert(t, d.PwmWrite(1), ErrPwmWriteUnsupported)
}
开发者ID:hybridgroup,项目名称:gobot,代码行数:7,代码来源:direct_pin_driver_test.go

示例4: TestLedDriver

func TestLedDriver(t *testing.T) {
	var err interface{}

	d := initTestLedDriver(newGpioTestAdaptor())

	gobottest.Assert(t, d.Pin(), "1")
	gobottest.Refute(t, d.Connection(), nil)

	testAdaptorDigitalWrite = func() (err error) {
		return errors.New("write error")
	}
	testAdaptorPwmWrite = func() (err error) {
		return errors.New("pwm error")
	}

	err = d.Command("Toggle")(nil)
	gobottest.Assert(t, err.(error), errors.New("write error"))

	err = d.Command("On")(nil)
	gobottest.Assert(t, err.(error), errors.New("write error"))

	err = d.Command("Off")(nil)
	gobottest.Assert(t, err.(error), errors.New("write error"))

	err = d.Command("Brightness")(map[string]interface{}{"level": 100.0})
	gobottest.Assert(t, err.(error), errors.New("pwm error"))

}
开发者ID:hybridgroup,项目名称:gobot,代码行数:28,代码来源:led_driver_test.go

示例5: TestButtonDriver

func TestButtonDriver(t *testing.T) {
	d := NewButtonDriver(newGpioTestAdaptor(), "1")
	gobottest.Refute(t, d.Connection(), nil)

	d = NewButtonDriver(newGpioTestAdaptor(), "1", 30*time.Second)
	gobottest.Assert(t, d.interval, 30*time.Second)
}
开发者ID:hybridgroup,项目名称:gobot,代码行数:7,代码来源:button_driver_test.go

示例6: TestRgbLedDriver

func TestRgbLedDriver(t *testing.T) {
	var err interface{}

	d := initTestRgbLedDriver(newGpioTestAdaptor())

	gobottest.Assert(t, d.Pin(), "r=1, g=2, b=3")
	gobottest.Assert(t, d.RedPin(), "1")
	gobottest.Assert(t, d.GreenPin(), "2")
	gobottest.Assert(t, d.BluePin(), "3")
	gobottest.Refute(t, d.Connection(), nil)

	testAdaptorDigitalWrite = func() (err error) {
		return errors.New("write error")
	}
	testAdaptorPwmWrite = func() (err error) {
		return errors.New("pwm error")
	}

	err = d.Command("Toggle")(nil)
	gobottest.Assert(t, err.(error), errors.New("pwm error"))

	err = d.Command("On")(nil)
	gobottest.Assert(t, err.(error), errors.New("pwm error"))

	err = d.Command("Off")(nil)
	gobottest.Assert(t, err.(error), errors.New("pwm error"))

	err = d.Command("SetRGB")(map[string]interface{}{"r": 0xff, "g": 0xff, "b": 0xff})
	gobottest.Assert(t, err.(error), errors.New("pwm error"))

}
开发者ID:hybridgroup,项目名称:gobot,代码行数:31,代码来源:rgb_led_driver_test.go

示例7: TestServoDriver

func TestServoDriver(t *testing.T) {
	var err interface{}

	d := initTestServoDriver()

	gobottest.Assert(t, d.Pin(), "1")
	gobottest.Refute(t, d.Connection(), nil)

	testAdaptorServoWrite = func() (err error) {
		return errors.New("pwm error")
	}

	err = d.Command("Min")(nil)
	gobottest.Assert(t, err.(error), errors.New("pwm error"))

	err = d.Command("Center")(nil)
	gobottest.Assert(t, err.(error), errors.New("pwm error"))

	err = d.Command("Max")(nil)
	gobottest.Assert(t, err.(error), errors.New("pwm error"))

	err = d.Command("Move")(map[string]interface{}{"angle": 100.0})
	gobottest.Assert(t, err.(error), errors.New("pwm error"))

}
开发者ID:hybridgroup,项目名称:gobot,代码行数:25,代码来源:servo_driver_test.go

示例8: TestAdaptorConnect

func TestAdaptorConnect(t *testing.T) {
	a, _ := initTestAdaptor()
	gobottest.Assert(t, a.Connect(), nil)

	a = NewAdaptor()
	sysfs.SetFilesystem(sysfs.NewMockFilesystem([]string{}))
	gobottest.Refute(t, a.Connect(), nil)
}
开发者ID:hybridgroup,项目名称:gobot,代码行数:8,代码来源:edison_adaptor_test.go

示例9: TestWiichuckDriver

func TestWiichuckDriver(t *testing.T) {
	wii := initTestWiichuckDriver()
	gobottest.Refute(t, wii.Connection(), nil)
	gobottest.Assert(t, wii.interval, 10*time.Millisecond)

	wii = NewWiichuckDriver(newI2cTestAdaptor(), 100*time.Millisecond)
	gobottest.Assert(t, wii.interval, 100*time.Millisecond)
}
开发者ID:hybridgroup,项目名称:gobot,代码行数:8,代码来源:wiichuck_driver_test.go

示例10: TestMPU6050Driver

func TestMPU6050Driver(t *testing.T) {
	mpu := initTestMPU6050Driver()
	gobottest.Refute(t, mpu.Connection(), nil)
	gobottest.Assert(t, mpu.interval, 10*time.Millisecond)

	mpu = NewMPU6050Driver(newI2cTestAdaptor(), 100*time.Millisecond)
	gobottest.Assert(t, mpu.interval, 100*time.Millisecond)
}
开发者ID:hybridgroup,项目名称:gobot,代码行数:8,代码来源:mpu6050_driver_test.go

示例11: TestAdaptorSetAPIServer

func TestAdaptorSetAPIServer(t *testing.T) {
	a := initTestAdaptor()
	apiServer := "new_api_server"
	gobottest.Refute(t, a.APIServer, apiServer)

	a.setAPIServer(apiServer)
	gobottest.Assert(t, a.APIServer, apiServer)
}
开发者ID:hybridgroup,项目名称:gobot,代码行数:8,代码来源:adaptor_test.go

示例12: TestMakeyButtonDriver

func TestMakeyButtonDriver(t *testing.T) {
	d := initTestMakeyButtonDriver()
	gobottest.Assert(t, d.Pin(), "1")
	gobottest.Refute(t, d.Connection(), nil)
	gobottest.Assert(t, d.interval, 10*time.Millisecond)

	d = NewMakeyButtonDriver(newGpioTestAdaptor(), "1", 30*time.Second)
	gobottest.Assert(t, d.interval, MAKEY_TEST_DELAY*time.Second)
}
开发者ID:hybridgroup,项目名称:gobot,代码行数:9,代码来源:makey_button_driver_test.go

示例13: TestMockFilesystemOpen

func TestMockFilesystemOpen(t *testing.T) {
	fs := NewMockFilesystem([]string{"foo"})
	f1 := fs.Files["foo"]

	gobottest.Assert(t, f1.Opened, false)
	f2, err := fs.OpenFile("foo", 0, 0666)
	gobottest.Assert(t, f1, f2)
	gobottest.Assert(t, err, nil)

	err = f2.Sync()
	gobottest.Assert(t, err, nil)

	_, err = fs.OpenFile("bar", 0, 0666)
	gobottest.Refute(t, err, nil)

	fs.Add("bar")
	f4, _ := fs.OpenFile("bar", 0, 0666)
	gobottest.Refute(t, f4.Fd(), f1.Fd())
}
开发者ID:hybridgroup,项目名称:gobot,代码行数:19,代码来源:fs_mock_test.go

示例14: TestNewMCP23017Driver

func TestNewMCP23017Driver(t *testing.T) {
	var bm interface{} = NewMCP23017Driver(newMcpI2cTestAdaptor(), MCP23017Config{}, 0x20)
	_, ok := bm.(*MCP23017Driver)
	if !ok {
		t.Errorf("NewMCP23017Driver() should have returned a *MCP23017Driver")
	}

	b := NewMCP23017Driver(newMcpI2cTestAdaptor(), MCP23017Config{}, 0x20)
	gobottest.Refute(t, b.Connection(), nil)
}
开发者ID:hybridgroup,项目名称:gobot,代码行数:10,代码来源:mcp23017_driver_test.go

示例15: TestAudioDriver

func TestAudioDriver(t *testing.T) {
	d := NewDriver(NewAdaptor(), "../../examples/laser.mp3")

	gobottest.Assert(t, d.Filename(), "../../examples/laser.mp3")

	gobottest.Refute(t, d.Connection(), nil)

	gobottest.Assert(t, d.Start(), nil)

	gobottest.Assert(t, d.Halt(), nil)
}
开发者ID:hybridgroup,项目名称:gobot,代码行数:11,代码来源:audio_driver_test.go


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