mirror of
https://github.com/vee1e/tflite-micro.git
synced 2026-09-01 17:57:27 +00:00
* changed TF_LITE_MICRO_EXPECT_* macros to check for int type inputs using std::is_same and decltype. * fix cpplint formatting * more cpplint changes * x86 compiler debug * more x86 test debug * debugging x86 * trying typeid instead of decltype/is_same combo * trying typeid instead of decltype/is_same combo * trying decltype/is_same again * trying decltype/is_same again * trying decltype/is_same again * trying decltype/is_same again * debug * testing #error * testing * testing * testing * testing * testing * trying * fixed cpplint error * fixing github formatting presubmit error * reverting changes * isolated test to try changes to macro on * Expect equal changes based on pr and bugonizer suggestions from Ting and Deqiang * figuring out why changes don't compile * syntax error * syntax error * debugging * fixed control flow mistake * Done with EQ macro time for NE * wrote changes to NE based on EQ changes * tested NE/EQ and then resotred file used for isolated testing back to what it was in main branch * formating change for git style check presubmit * formating change for git style check presubmit * formating change for git style check presubmit * refactored the parts of x86 and kernal test that weren't compatible with change. Replaced with EXPECT_NEAR equivalents using a very small epsilon * git presubmit style formatting changes * git presubmit style formatting changes * git presubmit style formatting changes * git presubmit style formatting changes * bazel test fixes for presubmit * change include iostream to type_traits for is_same * changed .0.0000000001f to 1e-5f in test for to make it easier to read * rolling back changes to all test files * changed to EXPECT_EQ and EXPECT_NE to use std::numeric_limits<decltype(delta)>::epsilon() * control flow fix * control flow fix * control flow fix * debugging * debugging * debugging * debugging * debugging * debugging compile error * reverting EXPECT_NE to prev change and testing EQ seperately * presubmit github formatting change * reverting example to test to main * git fromat fix for presubmit * git fromat fix for presubmit * changing is_same to is_floating_point to make code easier to read * changing is_same to is_floating_point to make code easier to read * debugging nullptr error with EXPECT_NE * debugging nullptr error with EXPECT_NE * debugging nullptr error with EXPECT_NE * debugging nullptr error with EXPECT_NE * debugging nullptr error with EXPECT_NE * debugging nullptr error with EXPECT_NE * debugging nullptr error with EXPECT_NE * debugging nullptr error with EXPECT_NE * debugging nullptr error with EXPECT_NE * not using NEAR like implementation for NE due to issues with Null_ptrs used in NE test. But honestly no current test use EXPECT_NE with floats or doubles. But in case they do added error message suggestion users use EXPECT_NEAR for Float double not equals testing * not using NEAR like implementation for NE due to issues with Null_ptrs used in NE test. But honestly no current test use EXPECT_NE with floats or doubles. But in case they do added error message suggestion users use EXPECT_NEAR for Float double not equals testing * logic error fix for if statement * returning test file used to test macro changes back to orginal * changed based on cr suggestions by deqiang * git style changes presubmit changes * git style changes presubmit changes * git style changes presubmit changes * git style changes presubmit changes * git style changes presubmit changes * git style changes presubmit changes * git style changes presubmit changes * git style changes presubmit changes * typo in a string * fixed all test that used nullptr's with EXPECT_NE to use EXPECT macro instead * github style presubmit fixes * github style presubmit fixes * github style presubmit fixes * fixing compiler errors non x86 and accidental change to a test file * channing EXPECT_NE in helloworld that was reverted * fixing presubmit * fixing style presubmit * fixing presubmit * changing TF_LITE_MICRO_EXPECT to be consistent * accidentally changed a variable name * changing all EXPECT to EXPECT(PTR != nullptr) * irrevlavent EXPECT macro usage * changing one ptr != nullptr to expect(ptr) * style fixes for presubmit * style fixes for presubmit * fixing file from merge conflict Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
50 lines
1.7 KiB
C++
50 lines
1.7 KiB
C++
/* Copyright 2020 The TensorFlow Authors. All Rights Reserved.
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
you may not use this file except in compliance with the License.
|
|
You may obtain a copy of the License at
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
See the License for the specific language governing permissions and
|
|
limitations under the License.
|
|
==============================================================================*/
|
|
|
|
#include "tensorflow/lite/micro/testing/micro_test.h"
|
|
|
|
TF_LITE_MICRO_TESTS_BEGIN
|
|
|
|
TF_LITE_MICRO_TEST(ArgumentsExecutedOnlyOnce) {
|
|
float count = 0.;
|
|
// Make sure either argument is executed once after macro expansion.
|
|
TF_LITE_MICRO_EXPECT_NEAR(0, count++, 0.1f);
|
|
TF_LITE_MICRO_EXPECT_NEAR(1, count++, 0.1f);
|
|
TF_LITE_MICRO_EXPECT_NEAR(count++, 2, 0.1f);
|
|
TF_LITE_MICRO_EXPECT_NEAR(count++, 3, 0.1f);
|
|
}
|
|
|
|
TF_LITE_MICRO_TEST(TestExpectEQ) {
|
|
// test TF_LITE_EXPECT_EQ for expected behavior
|
|
double a = 2.1;
|
|
TF_LITE_MICRO_EXPECT_EQ(0, 0);
|
|
TF_LITE_MICRO_EXPECT_EQ(true, true);
|
|
TF_LITE_MICRO_EXPECT_EQ(false, false);
|
|
TF_LITE_MICRO_EXPECT_EQ(2.1, a);
|
|
TF_LITE_MICRO_EXPECT_EQ(1.0, true);
|
|
TF_LITE_MICRO_EXPECT_EQ(1.0, 1);
|
|
}
|
|
|
|
TF_LITE_MICRO_TEST(TestExpectNE) {
|
|
// test TF_LITE_EXPECT_NE for expected behavior
|
|
float b = 2.1f;
|
|
double a = 2.1;
|
|
TF_LITE_MICRO_EXPECT_NE(0, 1);
|
|
TF_LITE_MICRO_EXPECT_NE(true, false);
|
|
TF_LITE_MICRO_EXPECT_NE(2.10005f, b);
|
|
TF_LITE_MICRO_EXPECT_NE(2.2, a);
|
|
}
|
|
|
|
TF_LITE_MICRO_TESTS_END
|