Migrating Lint to 1.3.1

This commit is contained in:
Vitor Pamplona
2024-07-03 11:06:02 -04:00
parent 692f7c4270
commit 8d88efd27b
201 changed files with 1858 additions and 1814 deletions

View File

@@ -35,8 +35,11 @@ import java.nio.charset.Charset
@RunWith(AndroidJUnit4::class)
class MetaTagsParserBenchmark {
private val html =
getInstrumentation().context.assets.open("github_amethyst.html")
.readBytes().toString(Charset.forName("utf-8"))
getInstrumentation()
.context.assets
.open("github_amethyst.html")
.readBytes()
.toString(Charset.forName("utf-8"))
@get:Rule
val benchmarkRule = BenchmarkRule()

View File

@@ -59,11 +59,13 @@ class RichTextParserBenchmark {
fun parseImageUrl() {
benchmarkRule.measureRepeated {
assertTrue(
RichTextParser().parseText(
"first https://m.primal.net/HeKw.jpg second",
EmptyTagList,
null,
).paragraphs[0].words[1] is ImageSegment,
RichTextParser()
.parseText(
"first https://m.primal.net/HeKw.jpg second",
EmptyTagList,
null,
).paragraphs[0]
.words[1] is ImageSegment,
)
}
}
@@ -72,11 +74,13 @@ class RichTextParserBenchmark {
fun parseNoSchemeUrl() {
benchmarkRule.measureRepeated {
assertTrue(
RichTextParser().parseText(
"first amethyst.social second",
EmptyTagList,
null,
).paragraphs[0].words[1] is LinkSegment,
RichTextParser()
.parseText(
"first amethyst.social second",
EmptyTagList,
null,
).paragraphs[0]
.words[1] is LinkSegment,
)
}
}
@@ -85,11 +89,13 @@ class RichTextParserBenchmark {
fun parseHashtag() {
benchmarkRule.measureRepeated {
assertTrue(
RichTextParser().parseText(
"first #amethyst second",
EmptyTagList,
null,
).paragraphs[0].words[1] is HashTagSegment,
RichTextParser()
.parseText(
"first #amethyst second",
EmptyTagList,
null,
).paragraphs[0]
.words[1] is HashTagSegment,
)
}
}

View File

@@ -83,8 +83,7 @@ class BechBenchmark {
-123,
6,
92,
)
.map { it.toByte() }
).map { it.toByte() }
benchmarkRule.measureRepeated { assertEquals(expected, myUser.bechToBytes().toList()) }
}
}

View File

@@ -38,8 +38,7 @@ class ContainsBenchmark {
"""Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of "de Finibus Bonorum et Malorum" (The Extremes of Good and Evil) by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during the Renaissance. The first line of Lorem Ipsum, "Lorem ipsum dolor sit amet..", comes from a line in section 1.10.32.
The standard chunk of Lorem Ipsum used since the 1500s is reproduced below for those interested. Sections 1.10.32 and 1.10.33 from "de Finibus Bonorum et Malorum" by Cicero are also reproduced in their exact original form, accompanied by English versions from the 1914 translation by H. Rackham.
"""
.intern()
""".intern()
val atTheMiddle = DualCase("Lorem Ipsum".lowercase(), "Lorem Ipsum".uppercase())
val atTheBeginning = DualCase("contrAry".lowercase(), "contrAry".uppercase())

View File

@@ -43,28 +43,48 @@ class HexBenchmark {
@Test
fun hexDecodeOurs() {
benchmarkRule.measureRepeated { com.vitorpamplona.quartz.encoders.Hex.decode(testHex) }
benchmarkRule.measureRepeated {
com.vitorpamplona.quartz.encoders.Hex
.decode(testHex)
}
}
@Test
fun hexEncodeOurs() {
val bytes = com.vitorpamplona.quartz.encoders.Hex.decode(testHex)
val bytes =
com.vitorpamplona.quartz.encoders.Hex
.decode(testHex)
benchmarkRule.measureRepeated {
assertEquals(testHex, com.vitorpamplona.quartz.encoders.Hex.encode(bytes))
assertEquals(
testHex,
com.vitorpamplona.quartz.encoders.Hex
.encode(bytes),
)
}
}
@Test
fun hexDecodeBaseSecp() {
benchmarkRule.measureRepeated { fr.acinq.secp256k1.Hex.decode(testHex) }
benchmarkRule.measureRepeated {
fr.acinq.secp256k1.Hex
.decode(testHex)
}
}
@Test
fun hexEncodeBaseSecp() {
val bytes = fr.acinq.secp256k1.Hex.decode(testHex)
val bytes =
fr.acinq.secp256k1.Hex
.decode(testHex)
benchmarkRule.measureRepeated { assertEquals(testHex, fr.acinq.secp256k1.Hex.encode(bytes)) }
benchmarkRule.measureRepeated {
assertEquals(
testHex,
fr.acinq.secp256k1.Hex
.encode(bytes),
)
}
}
@Test