Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
QuasselDroid-ng
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Janne Mareike Koschinski
QuasselDroid-ng
Commits
3a8002e4
There was a problem fetching the pipeline summary.
Verified
Commit
3a8002e4
authored
6 years ago
by
Janne Mareike Koschinski
Browse files
Options
Downloads
Patches
Plain Diff
Additional tests added
parent
8cddd459
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Pipeline
#
Changes
2
Pipelines
1
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/src/test/java/de/kuschku/libquassel/protocol/primitive/serializer/StringSerializerTest.kt
+27
-4
27 additions, 4 deletions
...sel/protocol/primitive/serializer/StringSerializerTest.kt
lib/src/test/resources/blns.txt
+688
-0
688 additions, 0 deletions
lib/src/test/resources/blns.txt
with
715 additions
and
4 deletions
lib/src/test/java/de/kuschku/libquassel/protocol/primitive/serializer/StringSerializerTest.kt
+
27
−
4
View file @
3a8002e4
...
...
@@ -20,14 +20,37 @@
package
de.kuschku.libquassel.protocol.primitive.serializer
import
de.kuschku.libquassel.util.roundTrip
import
org.hamcrest.BaseMatcher
import
org.hamcrest.Description
import
org.junit.Assert.assertEquals
import
org.junit.Assert.assertThat
import
org.junit.Test
class
StringSerializerTest
{
@Test
fun
testAll
()
{
assertEquals
(
"Test"
,
roundTrip
(
StringSerializer
.
UTF16
,
"Test"
))
assertEquals
(
"Test"
,
roundTrip
(
StringSerializer
.
UTF8
,
"Test"
))
assertEquals
(
"Test"
,
roundTrip
(
StringSerializer
.
C
,
"Test"
))
fun
testVigListOfNaughtyStrings
()
{
this
::
class
.
java
.
getResourceAsStream
(
"/blns.txt"
).
bufferedReader
(
Charsets
.
UTF_8
).
forEachLine
{
// Ignore comments
if
(!
it
.
startsWith
(
'#'
))
{
assertThat
<
String
>(
roundTrip
(
StringSerializer
.
UTF16
,
it
),
BomMatcher
(
it
))
assertThat
<
String
>(
roundTrip
(
StringSerializer
.
UTF8
,
it
),
BomMatcher
(
it
))
}
}
}
@Test
fun
testAscii
()
{
// The simple solution: Just test all
val
it
=
String
(
CharArray
(
256
,
Int
::
toChar
).
toList
().
shuffled
().
toCharArray
())
assertEquals
(
it
,
roundTrip
(
StringSerializer
.
C
,
it
))
}
private
class
BomMatcher
(
private
val
expected
:
String
)
:
BaseMatcher
<
String
>()
{
override
fun
describeTo
(
description
:
Description
?)
{
description
?.
appendText
(
expected
)
}
override
fun
matches
(
item
:
Any
?)
=
(
item
as
?
String
)
?.
endsWith
(
expected
.
trimStart
(
''
,
''
))
==
true
}
}
This diff is collapsed.
Click to expand it.
lib/src/test/resources/blns.txt
0 → 100644
+
688
−
0
View file @
3a8002e4
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment