GY-63_MS5611/libraries/I2CKeyPad/test/unit_test_001.cpp

77 lines
1.6 KiB
C++
Raw Normal View History

2021-01-29 06:31:58 -05:00
//
// FILE: unit_test_001.cpp
// AUTHOR: Rob Tillaart
// DATE: 2020-12-27
// PURPOSE: unit tests for the I2CKeyPad library
// https://github.com/RobTillaart/I2CKeyPad
// https://github.com/Arduino-CI/arduino_ci/blob/master/REFERENCE.md
//
// supported assertions
// https://github.com/Arduino-CI/arduino_ci/blob/master/cpp/unittest/Assertion.h#L33-L42
// ----------------------------
// assertEqual(expected, actual)
// assertNotEqual(expected, actual)
// assertLess(expected, actual)
// assertMore(expected, actual)
// assertLessOrEqual(expected, actual)
// assertMoreOrEqual(expected, actual)
// assertTrue(actual)
// assertFalse(actual)
// assertNull(actual)
// assertNotNull(actual)
#include <ArduinoUnitTests.h>
#include "Arduino.h"
#include "I2CKeyPad.h"
unittest_setup()
{
}
2021-11-08 07:13:29 -05:00
2021-01-29 06:31:58 -05:00
unittest_teardown()
{
}
2021-11-08 07:13:29 -05:00
2021-01-29 06:31:58 -05:00
unittest(test_constructor)
{
2021-11-08 07:13:29 -05:00
fprintf(stderr, "VERSION: %s\n", (char *) I2C_KEYPAD_LIB_VERSION);
2021-01-29 06:31:58 -05:00
const uint8_t KEYPAD_ADDRESS = 0x38;
2021-05-08 03:52:18 -04:00
I2CKeyPad keyPad(KEYPAD_ADDRESS);
2021-01-29 06:31:58 -05:00
assertEqual(I2C_KEYPAD_NOKEY, keyPad.getLastKey());
2021-05-08 03:52:18 -04:00
// assertTrue(keyPad.begin());
// assertTrue(keyPad.isConnected());
2021-01-29 06:31:58 -05:00
}
2021-11-08 07:13:29 -05:00
2021-01-29 06:31:58 -05:00
// Issues with Wire - to be investigated...
//
// unittest(test_read)
// {
2021-11-08 07:13:29 -05:00
// fprintf(stderr, "VERSION: %s\n", (char *) I2C_KEYPAD_LIB_VERSION);
2021-01-29 06:31:58 -05:00
// const uint8_t KEYPAD_ADDRESS = 0x38;
2021-05-08 03:52:18 -04:00
// I2CKeyPad keyPad(KEYPAD_ADDRESS);
2021-01-29 06:31:58 -05:00
// assertTrue(keyPad.isConnected());
2021-05-08 03:52:18 -04:00
// // assertTrue(keyPad.begin());
2021-01-29 06:31:58 -05:00
// // assertEqual(I2C_KEYPAD_NOKEY, keyPad.getKey());
// // assertFalse(keyPad.isPressed());
// }
2021-11-08 07:13:29 -05:00
2021-01-29 06:31:58 -05:00
unittest_main()
// --------