Brian Silverman | 395d625 | 2013-09-13 20:58:14 -0700 | [diff] [blame] | 1 | // Copyright 2012 Google Inc. All Rights Reserved. |
| 2 | // Author: charliehotel@google.com (Christopher Hoover) |
Brian Silverman | 7221e81 | 2013-09-13 22:32:12 -0700 | [diff] [blame] | 3 | // |
| 4 | // Modified by FRC Team 971. |
Brian Silverman | 395d625 | 2013-09-13 20:58:14 -0700 | [diff] [blame] | 5 | |
Brian Silverman | 7221e81 | 2013-09-13 22:32:12 -0700 | [diff] [blame] | 6 | #include "glibusb.h" |
Brian Silverman | 395d625 | 2013-09-13 20:58:14 -0700 | [diff] [blame] | 7 | |
| 8 | #include <sstream> |
| 9 | #include <gtest/gtest.h> |
| 10 | |
| 11 | namespace glibusb { |
| 12 | namespace testing { |
| 13 | |
| 14 | // Tests that DeviceLocationAndId gets streamed correctly. |
| 15 | TEST(LibusbTest, LogsLocationAndID) { |
| 16 | DeviceLocationAndId location_and_id; |
| 17 | location_and_id.location.bus_number = 10; |
| 18 | location_and_id.location.device_address = 20; |
| 19 | location_and_id.id.vendor_id = 0x30; |
| 20 | location_and_id.id.product_id = 0x40; |
| 21 | |
| 22 | std::stringstream out; |
| 23 | out << location_and_id; |
| 24 | EXPECT_EQ("010:020 0030:0040", out.str()); |
| 25 | } |
| 26 | |
| 27 | // Tests setup and teardown. |
| 28 | TEST(LibusbTest, SetupTeardown) { |
| 29 | Libusb libusb; |
| 30 | } |
| 31 | |
| 32 | // Tests SetDebug |
| 33 | TEST(LibusbTest, SetDebug) { |
| 34 | Libusb libusb; |
| 35 | libusb.SetDebug(1); |
| 36 | } |
| 37 | |
| 38 | } // namespace testing |
| 39 | } // namespace glibusb |