Skip to content

Commit 50f96a0

Browse files
phaitingHaiting Pu
andauthored
convert RuntimeInstrumentationTest to kotlin (#15079)
### Summary All tests are written in kotlin except extension/android/executorch_android/src/androidTest/java/org/pytorch/executorch/RuntimeInstrumentationTest.java, this change converts this test from java to kotlin so that all tests are now kotlin. ### Test plan Run test locally. Co-authored-by: Haiting Pu <[email protected]>
1 parent d691aad commit 50f96a0

File tree

2 files changed

+34
-37
lines changed

2 files changed

+34
-37
lines changed

extension/android/executorch_android/src/androidTest/java/org/pytorch/executorch/RuntimeInstrumentationTest.java

Lines changed: 0 additions & 37 deletions
This file was deleted.
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/*
2+
* Copyright (c) Meta Platforms, Inc. and affiliates.
3+
* All rights reserved.
4+
*
5+
* This source code is licensed under the BSD-style license found in the
6+
* LICENSE file in the root directory of this source tree.
7+
*/
8+
package org.pytorch.executorch
9+
10+
import androidx.test.ext.junit.runners.AndroidJUnit4
11+
import org.junit.Assert
12+
import org.junit.Test
13+
import org.junit.runner.RunWith
14+
15+
/** Unit tests for [ExecuTorchRuntime]. */
16+
@RunWith(AndroidJUnit4::class)
17+
class RuntimeInstrumentationTest {
18+
@Test
19+
fun testRuntimeApi() {
20+
val ops = ExecuTorchRuntime.getRegisteredOps()
21+
val backends = ExecuTorchRuntime.getRegisteredBackends()
22+
23+
Assert.assertNotNull(ops)
24+
Assert.assertNotNull(backends)
25+
26+
for (op in ops) {
27+
Assert.assertNotNull(op)
28+
}
29+
30+
for (backend in backends) {
31+
Assert.assertNotNull(backend)
32+
}
33+
}
34+
}

0 commit comments

Comments
 (0)