From e66b49ddc3e02e85806beb1cadd44ed850511d93 Mon Sep 17 00:00:00 2001 From: Dmitry Borisenko <49808844+DmitryBorisenko33@users.noreply.github.com> Date: Mon, 31 Aug 2020 01:55:03 +0300 Subject: [PATCH] test --- include/test.h | 4 ++++ src/main.cpp | 21 +++------------------ src/test.cpp | 28 ++++++++++++++++++++++++++++ 3 files changed, 35 insertions(+), 18 deletions(-) create mode 100644 include/test.h create mode 100644 src/test.cpp diff --git a/include/test.h b/include/test.h new file mode 100644 index 00000000..4383e14d --- /dev/null +++ b/include/test.h @@ -0,0 +1,4 @@ +#pragma once + +void setupTest(); +void loopTest(); \ No newline at end of file diff --git a/src/main.cpp b/src/main.cpp index 67f91d80..fdf97fcb 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,6 +1,6 @@ #include - +#include "test.h" #include "Class/CallBackTest.h" #include "Class/NotAsinc.h" #include "Class/ScenarioClass.h" @@ -87,22 +87,7 @@ void setup() { just_load = false; initialized = true; - String buf = "Geeks-for-Geeks"; - int buf_len = buf.length() + 1; - char char_array[buf_len]; - buf.toCharArray(char_array, buf_len); - char* token = strtok(char_array, "-"); - while (token != NULL) { - printf("%s\n", token); - token = strtok(NULL, "-"); - } - - //char str[] = "Geeks for Geeks"; - //char* token; - //char* rest = str; - //while ((token = strtok_r(rest, " ", &rest))) { - // printf("%s\n", token); - //} + setupTest(); } void loop() { @@ -122,7 +107,7 @@ void loop() { MqttClient::loop(); mySwitch->loop(); myScenario->loop(); - //loopScenario(); + loopTest(); loopCmd(); loopSerial(); diff --git a/src/test.cpp b/src/test.cpp new file mode 100644 index 00000000..57c88450 --- /dev/null +++ b/src/test.cpp @@ -0,0 +1,28 @@ +#include "Global.h" +#include "test.h" + +void setupTest() { + //пример выделения подстрок + String buf = "Geeks-for-Geeks"; + int buf_len = buf.length() + 1; + char char_array[buf_len]; + buf.toCharArray(char_array, buf_len); + + char* token = strtok(char_array, "-"); + + while (token != NULL) { + printf("%s\n", token); + token = strtok(NULL, "-"); + } + + //char str[] = "Geeks for Geeks"; + //char* token; + //char* rest = str; + //while ((token = strtok_r(rest, " ", &rest))) { + // printf("%s\n", token); + //} +} + +void loopTest() { + +} \ No newline at end of file