-
Notifications
You must be signed in to change notification settings - Fork 207
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #608 from bugsnag/ndk-serializer-tests
Add parameterised JSON serialisation tests for NDK serializer
- Loading branch information
Showing
35 changed files
with
1,079 additions
and
194 deletions.
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
...-android-ndk/src/androidTest/java/com/bugsnag/android/ndk/AppMetaDataSerializationTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package com.bugsnag.android.ndk | ||
|
||
import org.junit.Test | ||
import org.junit.runner.RunWith | ||
import org.junit.runners.Parameterized | ||
import org.junit.runners.Parameterized.* | ||
|
||
@RunWith(Parameterized::class) | ||
internal class AppMetaDataSerializationTest { | ||
|
||
companion object { | ||
init { | ||
System.loadLibrary("bugsnag-ndk") | ||
System.loadLibrary("bugsnag-ndk-test") | ||
} | ||
|
||
@JvmStatic | ||
@Parameters | ||
fun testCases() = 0..0 | ||
} | ||
|
||
external fun run(testCase: Int, expectedJson: String): Int | ||
|
||
@Parameter | ||
lateinit var testCase: Number | ||
|
||
@Test | ||
fun testPassesNativeSuite() { | ||
val expectedJson = loadJson("app_meta_data_serialization_$testCase.json") | ||
verifyNativeRun(run(testCase.toInt(), expectedJson)) | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
...g-plugin-android-ndk/src/androidTest/java/com/bugsnag/android/ndk/AppSerializationTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package com.bugsnag.android.ndk | ||
|
||
import org.junit.Test | ||
import org.junit.runner.RunWith | ||
import org.junit.runners.Parameterized | ||
import org.junit.runners.Parameterized.* | ||
|
||
@RunWith(Parameterized::class) | ||
internal class AppSerializationTest { | ||
|
||
companion object { | ||
init { | ||
System.loadLibrary("bugsnag-ndk") | ||
System.loadLibrary("bugsnag-ndk-test") | ||
} | ||
|
||
@JvmStatic | ||
@Parameters | ||
fun testCases() = 0..0 | ||
} | ||
|
||
external fun run(testCase: Int, expectedJson: String): Int | ||
|
||
@Parameter | ||
lateinit var testCase: Number | ||
|
||
@Test | ||
fun testPassesNativeSuite() { | ||
val expectedJson = loadJson("app_serialization_$testCase.json") | ||
verifyNativeRun(run(testCase.toInt(), expectedJson)) | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
...-android-ndk/src/androidTest/java/com/bugsnag/android/ndk/BreadcrumbsSerializationTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package com.bugsnag.android.ndk | ||
|
||
import org.junit.Test | ||
import org.junit.runner.RunWith | ||
import org.junit.runners.Parameterized | ||
import org.junit.runners.Parameterized.* | ||
|
||
@RunWith(Parameterized::class) | ||
internal class BreadcrumbsSerializationTest { | ||
|
||
companion object { | ||
init { | ||
System.loadLibrary("bugsnag-ndk") | ||
System.loadLibrary("bugsnag-ndk-test") | ||
} | ||
|
||
@JvmStatic | ||
@Parameters | ||
fun testCases() = 0..0 | ||
} | ||
|
||
external fun run(testCase: Int, expectedJson: String): Int | ||
|
||
@Parameter | ||
lateinit var testCase: Number | ||
|
||
@Test | ||
fun testPassesNativeSuite() { | ||
val expectedJson = loadJson("breadcrumbs_serialization_$testCase.json") | ||
verifyNativeRun(run(testCase.toInt(), expectedJson)) | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
...ugin-android-ndk/src/androidTest/java/com/bugsnag/android/ndk/ContextSerializationTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package com.bugsnag.android.ndk | ||
|
||
import org.junit.Test | ||
import org.junit.runner.RunWith | ||
import org.junit.runners.Parameterized | ||
import org.junit.runners.Parameterized.* | ||
|
||
@RunWith(Parameterized::class) | ||
internal class ContextSerializationTest { | ||
|
||
companion object { | ||
init { | ||
System.loadLibrary("bugsnag-ndk") | ||
System.loadLibrary("bugsnag-ndk-test") | ||
} | ||
|
||
@JvmStatic | ||
@Parameters | ||
fun testCases() = 0..0 | ||
} | ||
|
||
external fun run(testCase: Int, expectedJson: String): Int | ||
|
||
@Parameter | ||
lateinit var testCase: Number | ||
|
||
@Test | ||
fun testPassesNativeSuite() { | ||
val expectedJson = loadJson("context_serialization_$testCase.json") | ||
verifyNativeRun(run(testCase.toInt(), expectedJson)) | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
...droid-ndk/src/androidTest/java/com/bugsnag/android/ndk/CustomMetaDataSerializationTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package com.bugsnag.android.ndk | ||
|
||
import org.junit.Test | ||
import org.junit.runner.RunWith | ||
import org.junit.runners.Parameterized | ||
import org.junit.runners.Parameterized.* | ||
|
||
@RunWith(Parameterized::class) | ||
internal class CustomMetaDataSerializationTest { | ||
|
||
companion object { | ||
init { | ||
System.loadLibrary("bugsnag-ndk") | ||
System.loadLibrary("bugsnag-ndk-test") | ||
} | ||
|
||
@JvmStatic | ||
@Parameters | ||
fun testCases() = 0..0 | ||
} | ||
|
||
external fun run(testCase: Int, expectedJson: String): Int | ||
|
||
@Parameter | ||
lateinit var testCase: Number | ||
|
||
@Test | ||
fun testPassesNativeSuite() { | ||
val expectedJson = loadJson("custom_meta_data_serialization_$testCase.json") | ||
verifyNativeRun(run(testCase.toInt(), expectedJson)) | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
...droid-ndk/src/androidTest/java/com/bugsnag/android/ndk/DeviceMetaDataSerializationTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package com.bugsnag.android.ndk | ||
|
||
import org.junit.Test | ||
import org.junit.runner.RunWith | ||
import org.junit.runners.Parameterized | ||
import org.junit.runners.Parameterized.* | ||
|
||
@RunWith(Parameterized::class) | ||
internal class DeviceMetaDataSerializationTest { | ||
|
||
companion object { | ||
init { | ||
System.loadLibrary("bugsnag-ndk") | ||
System.loadLibrary("bugsnag-ndk-test") | ||
} | ||
|
||
@JvmStatic | ||
@Parameters | ||
fun testCases() = 0..0 | ||
} | ||
|
||
external fun run(testCase: Int, expectedJson: String): Int | ||
|
||
@Parameter | ||
lateinit var testCase: Number | ||
|
||
@Test | ||
fun testPassesNativeSuite() { | ||
val expectedJson = loadJson("device_meta_data_serialization_$testCase.json") | ||
verifyNativeRun(run(testCase.toInt(), expectedJson)) | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
...lugin-android-ndk/src/androidTest/java/com/bugsnag/android/ndk/DeviceSerializationTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package com.bugsnag.android.ndk | ||
|
||
import org.junit.Test | ||
import org.junit.runner.RunWith | ||
import org.junit.runners.Parameterized | ||
import org.junit.runners.Parameterized.* | ||
|
||
@RunWith(Parameterized::class) | ||
internal class DeviceSerializationTest { | ||
|
||
companion object { | ||
init { | ||
System.loadLibrary("bugsnag-ndk") | ||
System.loadLibrary("bugsnag-ndk-test") | ||
} | ||
|
||
@JvmStatic | ||
@Parameters | ||
fun testCases() = 0..0 | ||
} | ||
|
||
external fun run(testCase: Int, expectedJson: String): Int | ||
|
||
@Parameter | ||
lateinit var testCase: Number | ||
|
||
@Test | ||
fun testPassesNativeSuite() { | ||
val expectedJson = loadJson("device_serialization_$testCase.json") | ||
verifyNativeRun(run(testCase.toInt(), expectedJson)) | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
...in-android-ndk/src/androidTest/java/com/bugsnag/android/ndk/ExceptionSerializationTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package com.bugsnag.android.ndk | ||
|
||
import org.junit.Test | ||
import org.junit.runner.RunWith | ||
import org.junit.runners.Parameterized | ||
import org.junit.runners.Parameterized.* | ||
|
||
@RunWith(Parameterized::class) | ||
internal class ExceptionSerializationTest { | ||
|
||
companion object { | ||
init { | ||
System.loadLibrary("bugsnag-ndk") | ||
System.loadLibrary("bugsnag-ndk-test") | ||
} | ||
|
||
@JvmStatic | ||
@Parameters | ||
fun testCases() = 0..0 | ||
} | ||
|
||
external fun run(testCase: Int, expectedJson: String): Int | ||
|
||
@Parameter | ||
lateinit var testCase: Number | ||
|
||
@Test | ||
fun testPassesNativeSuite() { | ||
val expectedJson = loadJson("exception_serialization_$testCase.json") | ||
verifyNativeRun(run(testCase.toInt(), expectedJson)) | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
...android-ndk/src/androidTest/java/com/bugsnag/android/ndk/HandledStateSerializationTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package com.bugsnag.android.ndk | ||
|
||
import org.junit.Test | ||
import org.junit.runner.RunWith | ||
import org.junit.runners.Parameterized | ||
import org.junit.runners.Parameterized.* | ||
|
||
@RunWith(Parameterized::class) | ||
internal class HandledStateSerializationTest { | ||
|
||
companion object { | ||
init { | ||
System.loadLibrary("bugsnag-ndk") | ||
System.loadLibrary("bugsnag-ndk-test") | ||
} | ||
|
||
@JvmStatic | ||
@Parameters | ||
fun testCases() = 0..0 | ||
} | ||
|
||
external fun run(testCase: Int, expectedJson: String): Int | ||
|
||
@Parameter | ||
lateinit var testCase: Number | ||
|
||
@Test | ||
fun testPassesNativeSuite() { | ||
val expectedJson = loadJson("handled_state_serialization_$testCase.json") | ||
verifyNativeRun(run(testCase.toInt(), expectedJson)) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
bugsnag-plugin-android-ndk/src/androidTest/java/com/bugsnag/android/ndk/ResourceUtils.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
package com.bugsnag.android.ndk | ||
|
||
internal fun loadJson(resourceName: String) = | ||
NativeCXXTest::class.java.classLoader!!.getResource(resourceName).readText() |
32 changes: 32 additions & 0 deletions
32
...ugin-android-ndk/src/androidTest/java/com/bugsnag/android/ndk/SessionSerializationTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package com.bugsnag.android.ndk | ||
|
||
import org.junit.Test | ||
import org.junit.runner.RunWith | ||
import org.junit.runners.Parameterized | ||
import org.junit.runners.Parameterized.* | ||
|
||
@RunWith(Parameterized::class) | ||
internal class SessionSerializationTest { | ||
|
||
companion object { | ||
init { | ||
System.loadLibrary("bugsnag-ndk") | ||
System.loadLibrary("bugsnag-ndk-test") | ||
} | ||
|
||
@JvmStatic | ||
@Parameters | ||
fun testCases() = 0..0 | ||
} | ||
|
||
external fun run(testCase: Int, expectedJson: String): Int | ||
|
||
@Parameter | ||
lateinit var testCase: Number | ||
|
||
@Test | ||
fun testPassesNativeSuite() { | ||
val expectedJson = loadJson("session_serialization_$testCase.json") | ||
verifyNativeRun(run(testCase.toInt(), expectedJson)) | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
...n-android-ndk/src/androidTest/java/com/bugsnag/android/ndk/StackframeSerializationTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package com.bugsnag.android.ndk | ||
|
||
import org.junit.Test | ||
import org.junit.runner.RunWith | ||
import org.junit.runners.Parameterized | ||
import org.junit.runners.Parameterized.* | ||
|
||
@RunWith(Parameterized::class) | ||
internal class StackframeSerializationTest { | ||
|
||
companion object { | ||
init { | ||
System.loadLibrary("bugsnag-ndk") | ||
System.loadLibrary("bugsnag-ndk-test") | ||
} | ||
|
||
@JvmStatic | ||
@Parameters | ||
fun testCases() = 0..0 | ||
} | ||
|
||
external fun run(testCase: Int, expectedJson: String): Int | ||
|
||
@Parameter | ||
lateinit var testCase: Number | ||
|
||
@Test | ||
fun testPassesNativeSuite() { | ||
val expectedJson = loadJson("stackframe_serialization_$testCase.json") | ||
verifyNativeRun(run(testCase.toInt(), expectedJson)) | ||
} | ||
} |
Oops, something went wrong.