Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of mbed-os by
busout_ut.cpp
00001 #include "TestHarness.h" 00002 #include <utility> 00003 #include "mbed.h" 00004 00005 TEST_GROUP(BusOut_mask) 00006 { 00007 }; 00008 00009 TEST(BusOut_mask, led_1_2_3) 00010 { 00011 BusOut bus_data(LED1, LED2, LED3); 00012 CHECK_EQUAL(0x07, bus_data.mask()); 00013 } 00014 00015 TEST(BusOut_mask, led_nc_nc_nc_nc) 00016 { 00017 BusOut bus_data(NC, NC, NC, NC); 00018 CHECK_EQUAL(0x00, bus_data.mask()); 00019 } 00020 00021 TEST(BusOut_mask, led_1_2_3_nc_nc) 00022 { 00023 BusOut bus_data(LED1, LED2, LED3, NC, NC); 00024 CHECK_EQUAL(0x07, bus_data.mask()); 00025 } 00026 00027 TEST(BusOut_mask, led_1_nc_2_nc_nc_3) 00028 { 00029 BusOut bus_data(LED1, NC, LED2, NC, NC, LED3); 00030 CHECK_EQUAL(0x25, bus_data.mask()); 00031 } 00032 00033 /////////////////////////////////////////////////////////////////////////////// 00034 00035 TEST_GROUP(BusOut_dummy) 00036 { 00037 }; 00038 00039 TEST(BusOut_dummy, dummy) 00040 { 00041 } 00042 00043 TEST_GROUP(BusOut_digitalout_write) 00044 { 00045 }; 00046 00047 TEST(BusOut_digitalout_write, led_nc) 00048 { 00049 BusOut bus_data(NC); 00050 CHECK_EQUAL(false, bus_data[0].is_connected()) 00051 } 00052 00053 00054 TEST(BusOut_digitalout_write, led_1_2_3) 00055 { 00056 BusOut bus_data(LED1, LED2, LED3); 00057 bus_data[0].write(1); 00058 bus_data[1].write(1); 00059 bus_data[2].write(1); 00060 CHECK(bus_data[0].read()); 00061 CHECK(bus_data[1].read()); 00062 CHECK(bus_data[2].read()); 00063 } 00064 00065 TEST(BusOut_digitalout_write, led_1_2_3_nc_nc) 00066 { 00067 BusOut bus_data(LED1, LED2, LED3, NC, NC); 00068 bus_data[0].write(0); 00069 bus_data[1].write(0); 00070 bus_data[2].write(0); 00071 CHECK(bus_data[0].read() == 0); 00072 CHECK(bus_data[1].read() == 0); 00073 CHECK(bus_data[2].read() == 0); 00074 } 00075 00076 TEST(BusOut_digitalout_write, led_1_nc_2_nc_nc_3) 00077 { 00078 BusOut bus_data(LED1, NC, LED2, NC, NC, LED3); 00079 bus_data[0].write(1); 00080 bus_data[2].write(0); 00081 bus_data[5].write(0); 00082 CHECK(bus_data[0].read()); 00083 CHECK(bus_data[2].read() == 0); 00084 CHECK(bus_data[5].read() == 0); 00085 }
Generated on Tue Jul 12 2022 13:15:32 by
