1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-07-30 16:24:09 +03:00

device tests: some of them can be run on host (#6912)

* device tests: mock scripts + rename some tests to enable mock-testing them

* move symbol
This commit is contained in:
david gauchard
2019-12-16 19:20:07 +01:00
committed by GitHub
parent d1237fd016
commit d40dbb4584
16 changed files with 41 additions and 6 deletions

View File

@ -0,0 +1,35 @@
#include <BSTest.h>
BS_ENV_DECLARE();
void setup()
{
Serial.begin(115200);
BS_RUN(Serial);
}
bool pretest()
{
return true;
}
TEST_CASE("Floating point formatting works", "[newlib]")
{
char buf[16];
const float val = 0.02300;
snprintf(buf, sizeof(buf), "%.05f", val);
CHECK(String(buf) == "0.02300");
float res;
sscanf(buf, "%f", &res);
CHECK(res == val);
}
TEST_CASE("#612 fmod and sqrt work", "[newlib]")
{
CHECK(fabs(fmod(2.0, 1.5) - 0.5) < 1e-6);
CHECK(fabs(fmod(-10, -3) - (-1.0)) < 1e-5);
}
void loop()
{
}