mirror of
https://github.com/esp8266/Arduino.git
synced 2025-04-21 10:26:06 +03:00
Previously device tests included information such as access point SSID/password at compile time. This made it difficult to compile test binaries once and then send them to multiple test runners for execution. This change adds a command to the test library to set environment variable on the target device: “setenv key value”. C library setenv/getenv facility is used to store variables. Test runner, tests, and makefile are updated to use this functionality.
47 lines
590 B
C++
47 lines
590 B
C++
#include <BSTest.h>
|
|
|
|
BS_ENV_DECLARE();
|
|
|
|
void setup()
|
|
{
|
|
Serial.begin(115200);
|
|
BS_RUN(Serial);
|
|
}
|
|
|
|
|
|
TEST_CASE("this test runs successfully", "[bs]")
|
|
{
|
|
CHECK(1 + 1 == 2);
|
|
REQUIRE(2 * 2 == 4);
|
|
}
|
|
|
|
TEST_CASE("another test which fails", "[bs][fail]")
|
|
{
|
|
CHECK(true);
|
|
CHECK(false);
|
|
CHECK(true);
|
|
CHECK(false);
|
|
}
|
|
|
|
TEST_CASE("another test which fails and crashes", "[bs][fail]")
|
|
{
|
|
CHECK(true);
|
|
REQUIRE(false);
|
|
}
|
|
|
|
|
|
TEST_CASE("third test which should be skipped", "[.]")
|
|
{
|
|
FAIL();
|
|
}
|
|
|
|
|
|
TEST_CASE("this test also runs successfully", "[bs]")
|
|
{
|
|
|
|
}
|
|
|
|
void loop()
|
|
{
|
|
}
|