Added unit testing framework

This commit is contained in:
Ceikry 2022-04-18 06:23:41 +00:00 committed by Ryan
parent 41c81fe126
commit 1b9e330f68
3 changed files with 60 additions and 0 deletions

View file

@ -24,6 +24,11 @@ dependencies {
implementation 'org.jetbrains.kotlin:kotlin-reflect:1.5.20'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.4.2'
implementation group: 'com.moandjiezana.toml', name: 'toml4j', version: '0.7.2'
//Unit Tests
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.0'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.7.0'
implementation files(
"libs/PrimitiveExtensions-1.0.jar",
"libs/ConstLib-1.4.jar",
@ -37,6 +42,10 @@ dependencies {
)
}
test {
useJUnitPlatform()
}
/*sourceSets {
main.java.srcDirs = ['src/main/java']
main.kotlin.srcDirs = ['src/main/kotlin']

View file

@ -0,0 +1,50 @@
import api.IfaceSettingsBuilder
import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.Test
object APITests {
@Test fun testIfaceSettings(){
var builder = IfaceSettingsBuilder()
val testOptions = builder.enableOptions(0..9).build()
Assertions.assertEquals(2046, testOptions, "Testing option flags")
builder = IfaceSettingsBuilder()
val testSlotSwitch = builder.enableSlotSwitch().build()
Assertions.assertEquals(2097152, testSlotSwitch, "Testing slot switch flag")
builder = IfaceSettingsBuilder()
val testNullSlot = builder.enableNullSlotSwitch().build()
Assertions.assertEquals(8388608, testNullSlot, "Testing null slotswitch flag")
builder = IfaceSettingsBuilder()
val testUseWithFlags = builder.setUseOnSettings(true, true, true, true, true, true).build()
Assertions.assertEquals(129024, testUseWithFlags, "Testing usewith flags")
builder = IfaceSettingsBuilder()
val testIfaceDepth = builder.setInterfaceEventsDepth(2).build()
Assertions.assertEquals(2 shl 18, testIfaceDepth and 1835008, "Testing events depth")
builder = IfaceSettingsBuilder()
val testUseOption = builder.enableUseOption().build()
Assertions.assertEquals(1 shl 17, testUseOption, "Testing use option")
builder = IfaceSettingsBuilder()
val testUseOnSelf = builder.enableUseOnSelf().build()
Assertions.assertEquals(1 shl 22, testUseOnSelf, "Testing use on self flag")
builder = IfaceSettingsBuilder()
val testAllOptions = builder
.enableAllOptions()
.enableExamine()
.enableNullSlotSwitch()
.enableSlotSwitch()
.enableUseOnSelf()
.enableUseOption()
.setInterfaceEventsDepth(2)
.setUseOnSettings(true, true, true, true, true, true)
.build()
Assertions.assertEquals(15466494, testAllOptions, "Testing all options")
}
}

View file

@ -47,6 +47,7 @@ enable_botting = false
max_adv_bots = 100
wild_pvp_enabled = false
jad_practice_enabled = true
personalized_shops = true
[paths]
#path to the data folder, which contains the cache subfolder and such