@@ -22,7 +22,7 @@ limitations under the License.
2222#include " tensorflow/lite/micro/models/keyword_scrambled_model_data.h"
2323#include " tensorflow/lite/micro/recording_micro_allocator.h"
2424#include " tensorflow/lite/micro/recording_micro_interpreter.h"
25- #include " tensorflow/lite/micro/testing/micro_test .h"
25+ #include " tensorflow/lite/micro/testing/micro_test_v2 .h"
2626#include " tensorflow/lite/micro/testing/test_conv_model.h"
2727
2828/* *
@@ -138,12 +138,11 @@ void EnsureAllocatedSizeThreshold(const char* allocation_type, size_t actual,
138138 // TODO(b/158651472): Better auditing of non-64 bit systems:
139139 if (kIs64BitSystem ) {
140140 // 64-bit systems should check floor and ceiling to catch memory savings:
141- TF_LITE_MICRO_EXPECT_NEAR (actual, expected,
142- expected * kAllocationThreshold );
141+ EXPECT_NEAR (actual, expected, expected * kAllocationThreshold );
143142 } else {
144143 // Non-64 bit systems should just expect allocation does not exceed the
145144 // ceiling:
146- TF_LITE_MICRO_EXPECT_LE (actual, expected + expected * kAllocationThreshold );
145+ EXPECT_LE (actual, expected + expected * kAllocationThreshold );
147146 }
148147}
149148
@@ -213,24 +212,22 @@ void ValidateModelAllocationThresholds(
213212 sizeof (tflite::NodeAndRegistration) *
214213 thresholds.node_and_registration_count +
215214 thresholds.op_runtime_data_size ;
216- TF_LITE_MICRO_EXPECT_LE (thresholds.tail_alloc_size - tail_est_length,
217- kAllocationTailMiscCeiling );
215+ EXPECT_LE (thresholds.tail_alloc_size - tail_est_length,
216+ kAllocationTailMiscCeiling );
218217}
219218
220219} // namespace
221220
222- TF_LITE_MICRO_TESTS_BEGIN
223-
224- TF_LITE_MICRO_TEST (TestKeywordModelMemoryThreshold) {
221+ TEST (MemoryArenaThresholdTest, TestKeywordModelMemoryThreshold) {
225222 tflite::MicroMutableOpResolver<4 > op_resolver;
226- TF_LITE_MICRO_EXPECT_EQ (
223+ EXPECT_LEGACY_EQ (
227224 op_resolver.AddFullyConnected (tflite::Register_FULLY_CONNECTED_INT8 ()),
228225 kTfLiteOk );
229- TF_LITE_MICRO_EXPECT_EQ (op_resolver.AddQuantize (), kTfLiteOk );
230- TF_LITE_MICRO_EXPECT_EQ (
226+ EXPECT_LEGACY_EQ (op_resolver.AddQuantize (), kTfLiteOk );
227+ EXPECT_LEGACY_EQ (
231228 op_resolver.AddSoftmax (tflite::Register_SOFTMAX_INT8_INT16 ()), kTfLiteOk );
232- TF_LITE_MICRO_EXPECT_EQ (op_resolver.AddSvdf (tflite::Register_SVDF_INT8 ()),
233- kTfLiteOk );
229+ EXPECT_LEGACY_EQ (op_resolver.AddSvdf (tflite::Register_SVDF_INT8 ()),
230+ kTfLiteOk );
234231 tflite::RecordingMicroInterpreter interpreter (
235232 tflite::GetModel (g_keyword_scrambled_model_data), op_resolver,
236233 keyword_model_tensor_arena, kKeywordModelTensorArenaSize );
@@ -261,14 +258,14 @@ TF_LITE_MICRO_TEST(TestKeywordModelMemoryThreshold) {
261258 thresholds);
262259}
263260
264- TF_LITE_MICRO_TEST ( TestConvModelMemoryThreshold) {
261+ TEST (MemoryArenaThresholdTest, TestConvModelMemoryThreshold) {
265262 tflite::MicroMutableOpResolver<6 > op_resolver;
266- TF_LITE_MICRO_EXPECT_EQ (op_resolver.AddConv2D (), kTfLiteOk );
267- TF_LITE_MICRO_EXPECT_EQ (op_resolver.AddQuantize (), kTfLiteOk );
268- TF_LITE_MICRO_EXPECT_EQ (op_resolver.AddMaxPool2D (), kTfLiteOk );
269- TF_LITE_MICRO_EXPECT_EQ (op_resolver.AddReshape (), kTfLiteOk );
270- TF_LITE_MICRO_EXPECT_EQ (op_resolver.AddFullyConnected (), kTfLiteOk );
271- TF_LITE_MICRO_EXPECT_EQ (op_resolver.AddDequantize (), kTfLiteOk );
263+ EXPECT_LEGACY_EQ (op_resolver.AddConv2D (), kTfLiteOk );
264+ EXPECT_LEGACY_EQ (op_resolver.AddQuantize (), kTfLiteOk );
265+ EXPECT_LEGACY_EQ (op_resolver.AddMaxPool2D (), kTfLiteOk );
266+ EXPECT_LEGACY_EQ (op_resolver.AddReshape (), kTfLiteOk );
267+ EXPECT_LEGACY_EQ (op_resolver.AddFullyConnected (), kTfLiteOk );
268+ EXPECT_LEGACY_EQ (op_resolver.AddDequantize (), kTfLiteOk );
272269
273270 tflite::RecordingMicroInterpreter interpreter (
274271 tflite::GetModel (kTestConvModelData ), op_resolver, test_conv_tensor_arena,
@@ -298,4 +295,4 @@ TF_LITE_MICRO_TEST(TestConvModelMemoryThreshold) {
298295 thresholds);
299296}
300297
301- TF_LITE_MICRO_TESTS_END
298+ TF_LITE_MICRO_TESTS_MAIN
0 commit comments