diff options
author | Michael Butler <butlermichael@google.com> | 2020-04-30 11:20:27 -0700 |
---|---|---|
committer | Michael Butler <butlermichael@google.com> | 2020-04-30 22:58:52 -0700 |
commit | b9c1528ed7e13d2826905e46a4d2efea618f34d8 (patch) | |
tree | a73ca64d1ba37ee6f714fb3a106575230d46432e /nn/runtime/test/TestValidation.cpp | |
parent | e6ed0fc145d449239ad753d8b268a96b928dc830 (diff) | |
download | ml-b9c1528ed7e13d2826905e46a4d2efea618f34d8.tar.gz |
Add more NN priority validation tests
Bug: 147925145
Test: mma
Test: NeuralNetworksTest_static
Change-Id: Ie636c7cdc84ff7a262925f8ff8ebbd4d4f45201b
Diffstat (limited to 'nn/runtime/test/TestValidation.cpp')
-rw-r--r-- | nn/runtime/test/TestValidation.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/nn/runtime/test/TestValidation.cpp b/nn/runtime/test/TestValidation.cpp index cf79d972f..181d39957 100644 --- a/nn/runtime/test/TestValidation.cpp +++ b/nn/runtime/test/TestValidation.cpp @@ -1109,6 +1109,19 @@ TEST_F(ValidationTestCompilation, SetCaching) { TEST_F(ValidationTestCompilation, SetPriority) { EXPECT_EQ(ANeuralNetworksCompilation_setPriority(nullptr, ANEURALNETWORKS_PRIORITY_DEFAULT), ANEURALNETWORKS_UNEXPECTED_NULL); + + // Test invalid values of priority. + constexpr int kInvalidPriorities[] = {0, + ANEURALNETWORKS_PRIORITY_LOW - 1, + ANEURALNETWORKS_PRIORITY_LOW + 1, + ANEURALNETWORKS_PRIORITY_MEDIUM - 1, + ANEURALNETWORKS_PRIORITY_MEDIUM + 1, + ANEURALNETWORKS_PRIORITY_HIGH - 1, + ANEURALNETWORKS_PRIORITY_HIGH + 1}; + for (int invalidPriority : kInvalidPriorities) { + EXPECT_EQ(ANeuralNetworksCompilation_setPriority(mCompilation, invalidPriority), + ANEURALNETWORKS_BAD_DATA); + } } // Also see TEST_F(ValidationTestCompilationForDevices_1, SetTimeout) |