Untitled

mail@pastecode.io avatar
unknown
kotlin
2 months ago
11 kB
4
Indexable
Never
fun testKillFeedInterpretation() {
        var expression = ""
        expression = "SCRIPT : string output = '20:35:19.468 [Killfeed] Alema_Gamess got killed by Survivor (Shamans) with AAC Honey Badger from a distance of 33 m.'"
        run {
            println("Testing expression [$expression]")
            val matcher = KillingProcessingEngine.killFeedEventPattern.matcher(expression)
            if (!matcher.find()) {
                assert(false) { "[$expression] doesn't match killfeed pattern" }
                return
            }
            val event = KillFeedEvent(matcher)
            assertNotNull(event.killedBy) { "killfeed event [killedBy] should't be null for expression [$expression]" }
            assertNotNull(event.killedWith) { "killfeed event [killedBy] should't be null for expression [$expression]" }
            assertNotNull(event.killedDistanceMeters) { "killfeed event [killedDistanceMeters] should't be null for expression [$expression]" }
        }
        expression = "SCRIPT : string output = '18:23:00.476 [Killfeed] LeJack got killed by Survivor (West) with AAC Honey Badger from a distance of 9 m.'"
        run {
            println("Testing expression [$expression]")
            val matcher = KillingProcessingEngine.killFeedEventPattern.matcher(expression)
            if (!matcher.find()) {
                assert(false) { "[$expression] doesn't match killfeed pattern" }
                return
            }
            val event = KillFeedEvent(matcher)
            assertNotNull(event.killedBy) { "killfeed event [killedBy] should't be null for expression [$expression]" }
            assertNotNull(event.killedWith) { "killfeed event [killedBy] should't be null for expression [$expression]" }
            assertNotNull(event.killedDistanceMeters) { "killfeed event [killedDistanceMeters] should't be null for expression [$expression]" }
        }
        expression = "SCRIPT : string output = '19:02:13.093 [Killfeed] Maggor got killed.'"
        run {
            println("Testing expression [$expression]")
            val matcher = KillingProcessingEngine.killFeedEventPattern.matcher(expression)
            if (!matcher.find()) {
                assert(false) { "[$expression] doesn't match killfeed pattern" }
                return
            }
            val event = KillFeedEvent(matcher)
            assertNull(event.killedBy) { "killfeed event [killedBy] should be null for expression [$expression]" }
            assertNull(event.killedWith) { "killfeed event [killedBy] should be null for expression [$expression]" }
            assertNull(event.killedDistanceMeters) { "killfeed event [killedDistanceMeters] should be null for expression [$expression]" }
        }
        expression = "SCRIPT : string output = '17:47:57.328 [Killfeed] Maggor got killed by an Infected.'"
        run {
            println("Testing expression [$expression]")
            val matcher = KillingProcessingEngine.killFeedEventPattern.matcher(expression)
            if (!matcher.find()) {
                assert(false) { "[$expression] doesn't match killfeed pattern" }
                return
            }
            val event = KillFeedEvent(matcher)
            assertNotNull(event.killedBy) { "killfeed event [killedBy] should't be null for expression [$expression]" }
            assertNull(event.killedWith) { "killfeed event [killedBy] should be null for expression [$expression]" }
            assertNull(event.killedDistanceMeters) { "killfeed event [killedDistanceMeters] should be null for expression [$expression]" }
        }
        expression = "SCRIPT : string output = '03:59:07.288 [Killfeed] MTADOG commited suicide with MK II.'"
        run {
            println("Testing expression [$expression]")
            val matcher = KillingProcessingEngine.killFeedEventPattern.matcher(expression)
            if (!matcher.find()) {
                assert(false) { "[$expression] doesn't match killfeed pattern" }
                return
            }
            val event = KillFeedEvent(matcher)
            assertNull(event.killedBy) { "killfeed event [killedBy] should be null for expression [$expression]" }
            assertNotNull(event.killedWith) { "killfeed event [killedBy] should't be null for expression [$expression]" }
            assertNull(event.killedDistanceMeters) { "killfeed event [killedDistanceMeters] should be null for expression [$expression]" }
        }
        expression = "SCRIPT : string output = '03:55:08.731 [Killfeed] MTADOG got beaten to a pulp by Survivor (Shamans) with bare hands.'"
        run {
            println("Testing expression [$expression]")
            val matcher = KillingProcessingEngine.killFeedEventPattern.matcher(expression)
            if (!matcher.find()) {
                assert(false) { "[$expression] doesn't match killfeed pattern" }
                return
            }
            val event = KillFeedEvent(matcher)
            assertNotNull(event.killedBy) { "killfeed event [killedBy] should't be null for expression [$expression]" }
            assertNotNull(event.killedWith) { "killfeed event [killedBy] should't be null for expression [$expression]" }
            assertNull(event.killedDistanceMeters) { "killfeed event [killedDistanceMeters] should be null for expression [$expression]" }
        }
        expression = "SCRIPT : string output = '20:00:05.851 [Killfeed] SrRa starved to death.'"
        run {
            println("Testing expression [$expression]")
            val matcher = KillingProcessingEngine.killFeedEventPattern.matcher(expression)
            if (!matcher.find()) {
                assert(false) { "[$expression] doesn't match killfeed pattern" }
                return
            }
            val event = KillFeedEvent(matcher)
            assertNull(event.killedBy) { "killfeed event [killedBy] should be null for expression [$expression]" }
            assertNull(event.killedWith) { "killfeed event [killedBy] should be null for expression [$expression]" }
            assertNull(event.killedDistanceMeters) { "killfeed event [killedDistanceMeters] should be null for expression [$expression]" }
        }
        expression = "SCRIPT : string output = '14:18:52.664 [Killfeed] SrRa burned to death.'"
        run {
            println("Testing expression [$expression]")
            val matcher = KillingProcessingEngine.killFeedEventPattern.matcher(expression)
            if (!matcher.find()) {
                assert(false) { "[$expression] doesn't match killfeed pattern" }
                return
            }
            val event = KillFeedEvent(matcher)
            assertNull(event.killedBy) { "killfeed event [killedBy] should be null for expression [$expression]" }
            assertNull(event.killedWith) { "killfeed event [killedBy] should be null for expression [$expression]" }
            assertNull(event.killedDistanceMeters) { "killfeed event [killedDistanceMeters] should be null for expression [$expression]" }
        }
        expression = "SCRIPT : string output = '19:22:56.265 [Killfeed] Pacha bled out.'"
        run {
            println("Testing expression [$expression]")
            val matcher = KillingProcessingEngine.killFeedEventPattern.matcher(expression)
            if (!matcher.find()) {
                assert(false) { "[$expression] doesn't match killfeed pattern" }
                return
            }
            val event = KillFeedEvent(matcher)
            assertNull(event.killedBy) { "killfeed event [killedBy] should be null for expression [$expression]" }
            assertNull(event.killedWith) { "killfeed event [killedBy] should be null for expression [$expression]" }
            assertNull(event.killedDistanceMeters) { "killfeed event [killedDistanceMeters] should be null for expression [$expression]" }
        }
        expression = "SCRIPT : string output = '20:40:55.125 [Killfeed] Jhonn Skaf got mauled to death by a Wolf.'"
        run {
            println("Testing expression [$expression]")
            val matcher = KillingProcessingEngine.killFeedEventPattern.matcher(expression)
            if (!matcher.find()) {
                assert(false) { "[$expression] doesn't match killfeed pattern" }
                return
            }
            val event = KillFeedEvent(matcher)
            assertNotNull(event.killedBy) { "killfeed event [killedBy] should't be null for expression [$expression]" }
            assertNull(event.killedWith) { "killfeed event [killedBy] should be null for expression [$expression]" }
            assertNull(event.killedDistanceMeters) { "killfeed event [killedDistanceMeters] should be null for expression [$expression]" }
        }
        expression = "SCRIPT : string output = '02:37:51.063 [Killfeed] LeJack died because of dehydration.'"
        run {
            println("Testing expression [$expression]")
            val matcher = KillingProcessingEngine.killFeedEventPattern.matcher(expression)
            if (!matcher.find()) {
                assert(false) { "[$expression] doesn't match killfeed pattern" }
                return
            }
            val event = KillFeedEvent(matcher)
            assertNull(event.killedBy) { "killfeed event [killedBy] should be null for expression [$expression]" }
            assertNull(event.killedWith) { "killfeed event [killedBy] should be null for expression [$expression]" }
            assertNull(event.killedDistanceMeters) { "killfeed event [killedDistanceMeters] should be null for expression [$expression]" }
        }
        expression = "SCRIPT       : string output = '05:39:22.851 [Killfeed] Ya_Heiro was killed by an explosion caused by 40mm Explosive Grenade.'"
        run {
            println("Testing expression [$expression]")
            val matcher = KillingProcessingEngine.killFeedEventPattern.matcher(expression)
            if (!matcher.find()) {
                assert(false) { "[$expression] doesn't match killfeed pattern" }
                return
            }
            val event = KillFeedEvent(matcher)
            assertNotNull(event.killedBy) { "killfeed event [killedBy] should't be null for expression [$expression]" }
            assertNotNull(event.killedWith) { "killfeed event [killedWith] should't be null for expression [$expression]" }
            assertNull(event.killedDistanceMeters) { "killfeed event [killedDistanceMeters] should be null for expression [$expression]" }
        }
    }
Leave a Comment