Move tests to appropriate modules (#3377)

This commit is contained in:
Phil Oliver
2025-10-07 12:23:41 -04:00
committed by GitHub
parent e1da9fda01
commit 9a6c78fcd1
7 changed files with 12 additions and 66 deletions

View File

@@ -1,39 +0,0 @@
/*
* Copyright (c) 2025 Meshtastic LLC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.geeksville.mesh
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.platform.app.InstrumentationRegistry
import org.junit.Assert.assertEquals
import org.junit.Test
import org.junit.runner.RunWith
/**
* Instrumented test, which will execute on an Android device.
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
@RunWith(AndroidJUnit4::class)
class ExampleInstrumentedTest {
@Test
fun useAppContext() {
// Context of the app under test.
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
assertEquals("com.geeksville.mesh", appContext.packageName)
}
}

View File

@@ -38,4 +38,6 @@ dependencies {
implementation(libs.timber)
implementation(libs.zxing.android.embedded) { isTransitive = false }
implementation(libs.zxing.core)
testImplementation(libs.androidx.core.ktx)
}

View File

@@ -15,14 +15,13 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.geeksville.mesh
package org.meshtastic.core.model
import androidx.test.ext.junit.runners.AndroidJUnit4
import com.geeksville.mesh.channelSet
import org.junit.Assert
import org.junit.Test
import org.junit.runner.RunWith
import org.meshtastic.core.model.Channel
import org.meshtastic.core.model.numChannels
import org.meshtastic.core.model.util.URL_PREFIX
import org.meshtastic.core.model.util.getChannelUrl
import org.meshtastic.core.model.util.toChannelSet

View File

@@ -15,29 +15,17 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.geeksville.mesh
package org.meshtastic.core.model.util
import android.net.Uri
import dagger.hilt.android.testing.HiltAndroidRule
import dagger.hilt.android.testing.HiltAndroidTest
import androidx.test.ext.junit.runners.AndroidJUnit4
import org.junit.Assert
import org.junit.Before
import org.junit.Rule
import org.junit.Test
import org.meshtastic.core.model.util.getChannelUrl
import org.meshtastic.core.model.util.primaryChannel
import org.meshtastic.core.model.util.toChannelSet
import org.junit.runner.RunWith
@HiltAndroidTest
@RunWith(AndroidJUnit4::class)
class ChannelSetTest {
@get:Rule var hiltRule = HiltAndroidRule(this)
@Before
fun init() {
hiltRule.inject()
}
/** make sure we match the python and device code behavior */
@Test
fun matchPython() {

View File

@@ -15,11 +15,10 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.geeksville.mesh.model
package org.meshtastic.core.model
import org.junit.Assert.assertEquals
import org.junit.Test
import org.meshtastic.core.model.DeviceVersion
class DeviceVersionTest {
/** make sure we match the python and device code behavior */

View File

@@ -15,17 +15,15 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.geeksville.mesh
package org.meshtastic.core.model
import androidx.core.os.LocaleListCompat
import com.geeksville.mesh.ConfigProtos.Config.DisplayConfig.DisplayUnits
import com.geeksville.mesh.MeshProtos
import org.junit.After
import org.junit.Assert
import org.junit.Before
import org.junit.Test
import org.meshtastic.core.model.MeshUser
import org.meshtastic.core.model.NodeInfo
import org.meshtastic.core.model.Position
import java.util.Locale
class NodeInfoTest {

View File

@@ -15,11 +15,10 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.geeksville.mesh
package org.meshtastic.core.model
import org.junit.Assert
import org.junit.Test
import org.meshtastic.core.model.Position
class PositionTest {
@Test