Skip to content

Commit

Permalink
Tweaks to Chat test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
sashaweiss-signal authored Sep 4, 2024
1 parent f6eb5ed commit 995dbdb
Show file tree
Hide file tree
Showing 70 changed files with 84 additions and 76 deletions.
8 changes: 8 additions & 0 deletions src/main/kotlin/Permutations.kt
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,8 @@ class PermutationScope : Iterator<List<Message<*, *>>> {

fun someDecrementingTimestamp(lower: Long = 1659383695000, upper: Long = 1911844456000): Long = some(Generators.decrementingTimestamps(lower, upper))

fun someExpirationTimerMs(): Long = some(Generators.expirationTimersMs())

fun someE164(): Long = some(Generators.e164s())

fun someUuid(): UUID = some(Generators.uuids())
Expand Down Expand Up @@ -275,6 +277,12 @@ object Generators {
fun picoMobs(): Generator<String> = Generators.list(SeededRandom.string(18, 25, "123456789"), SeededRandom.string(18, 25, "123456789"))
fun colors(): Generator<Int> = Generators.list(seededRandomColor(), seededRandomColor(), seededRandomColor())

/**
* Expiration timers are 64-bit values that should be second-aligned
* (divisible by 1000), and whose value-as-seconds should fit into 32-bits.
*/
fun expirationTimersMs(): Generator<Long> = Generators.list(0L, SeededRandom.long(0, Int.MAX_VALUE.toLong()) * 1000, SeededRandom.long(0, Int.MAX_VALUE.toLong()) * 1000)

fun <T> list(vararg items: T): Generator<T> = ListGenerator(items.toList())
fun <T> list(items: List<T>): Generator<T> = ListGenerator(items)
fun <T> single(item: T): Generator<T> = Generators.list(item)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ object ChatItemExpirationTimerUpdateTestCase : TestCase("chat_item_expiration_ti
directionless = ChatItem.DirectionlessMessageDetails(),
updateMessage = ChatUpdateMessage(
expirationTimerChange = ExpirationTimerChatUpdate(
expiresInMs = somePositiveLong()
expiresInMs = someExpirationTimerMs()
)
)
)
Expand Down
6 changes: 3 additions & 3 deletions src/main/kotlin/tests/ChatTestCase.kt
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ object ChatTestCase : TestCase("chat") {
frames += Frame(
chat = Chat(
id = 3,
recipientId = StandardFrames.chatAlice.chat!!.id,
recipientId = StandardFrames.recipientAlice.recipient!!.id,
archived = someBoolean(),
pinnedOrder = some(Generators.list(listOf(0, 1))),
expirationTimerMs = somePositiveLong(),
muteUntilMs = somePositiveLong(),
expirationTimerMs = someExpirationTimerMs(),
muteUntilMs = someTimestamp(),
markedUnread = someBoolean(),
dontNotifyForMentionsIfMuted = someBoolean(),
style = somePermutation {
Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/tests/RecipientCallLinkTestCase.kt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ object RecipientCallLinkTestCase : TestCase("recipient_call_link") {
adminKey = someNullableBytes(32)?.toByteString(),
name = someString(),
restrictions = someEnum(CallLink.Restrictions::class.java, excluding = CallLink.Restrictions.UNKNOWN),
expirationMs = somePositiveLong()
expirationMs = someExpirationTimerMs()
)
)
)
Expand Down
Binary file modified test-cases/chat_00.binproto
Binary file not shown.
2 changes: 1 addition & 1 deletion test-cases/chat_00.txtproto
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ Frame {
dontNotifyForMentionsIfMuted = true
id = 3
markedUnread = true
recipientId = 2
recipientId = 4
style = ChatStyle {
autoBubbleColor = AutomaticBubbleColor {}
dimWallpaperInDarkMode = true
Expand Down
Binary file modified test-cases/chat_01.binproto
Binary file not shown.
6 changes: 3 additions & 3 deletions test-cases/chat_01.txtproto
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,11 @@ Frame {

Frame {
chat = Chat {
expirationTimerMs = 5826213532931346611
expirationTimerMs = 296226146000
id = 3
muteUntilMs = 3788253560711682182
muteUntilMs = 1723689901182
pinnedOrder = 1
recipientId = 2
recipientId = 4
style = ChatStyle {
bubbleColorPreset = BubbleColorPreset.SOLID_ULTRAMARINE
wallpaperPhoto = FilePointer {
Expand Down
Binary file modified test-cases/chat_02.binproto
Binary file not shown.
6 changes: 3 additions & 3 deletions test-cases/chat_02.txtproto
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,11 @@ Frame {
chat = Chat {
archived = true
dontNotifyForMentionsIfMuted = true
expirationTimerMs = 937018508425176998
expirationTimerMs = 145232483000
id = 3
markedUnread = true
muteUntilMs = 6481873439951717697
recipientId = 2
muteUntilMs = 1864331637697
recipientId = 4
style = ChatStyle {
bubbleColorPreset = BubbleColorPreset.SOLID_CRIMSON
dimWallpaperInDarkMode = true
Expand Down
Binary file modified test-cases/chat_03.binproto
Binary file not shown.
2 changes: 1 addition & 1 deletion test-cases/chat_03.txtproto
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ Frame {
chat = Chat {
id = 3
pinnedOrder = 1
recipientId = 2
recipientId = 4
style = ChatStyle {
bubbleColorPreset = BubbleColorPreset.SOLID_VERMILION
wallpaperPhoto = FilePointer {
Expand Down
Binary file modified test-cases/chat_04.binproto
Binary file not shown.
6 changes: 3 additions & 3 deletions test-cases/chat_04.txtproto
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,11 @@ Frame {
chat = Chat {
archived = true
dontNotifyForMentionsIfMuted = true
expirationTimerMs = 5826213532931346611
expirationTimerMs = 296226146000
id = 3
markedUnread = true
muteUntilMs = 3788253560711682182
recipientId = 2
muteUntilMs = 1723689901182
recipientId = 4
style = ChatStyle {
bubbleColorPreset = BubbleColorPreset.SOLID_BURLAP
dimWallpaperInDarkMode = true
Expand Down
Binary file modified test-cases/chat_05.binproto
Binary file not shown.
6 changes: 3 additions & 3 deletions test-cases/chat_05.txtproto
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,11 @@ Frame {

Frame {
chat = Chat {
expirationTimerMs = 937018508425176998
expirationTimerMs = 145232483000
id = 3
muteUntilMs = 6481873439951717697
muteUntilMs = 1864331637697
pinnedOrder = 1
recipientId = 2
recipientId = 4
style = ChatStyle {
bubbleColorPreset = BubbleColorPreset.SOLID_FOREST
wallpaperPhoto = FilePointer {
Expand Down
Binary file modified test-cases/chat_06.binproto
Binary file not shown.
2 changes: 1 addition & 1 deletion test-cases/chat_06.txtproto
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ Frame {
dontNotifyForMentionsIfMuted = true
id = 3
markedUnread = true
recipientId = 2
recipientId = 4
style = ChatStyle {
bubbleColorPreset = BubbleColorPreset.SOLID_WINTERGREEN
dimWallpaperInDarkMode = true
Expand Down
Binary file modified test-cases/chat_07.binproto
Binary file not shown.
6 changes: 3 additions & 3 deletions test-cases/chat_07.txtproto
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,11 @@ Frame {

Frame {
chat = Chat {
expirationTimerMs = 5826213532931346611
expirationTimerMs = 296226146000
id = 3
muteUntilMs = 3788253560711682182
muteUntilMs = 1723689901182
pinnedOrder = 1
recipientId = 2
recipientId = 4
style = ChatStyle {
bubbleColorPreset = BubbleColorPreset.SOLID_TEAL
wallpaperPhoto = FilePointer {
Expand Down
Binary file modified test-cases/chat_08.binproto
Binary file not shown.
6 changes: 3 additions & 3 deletions test-cases/chat_08.txtproto
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,11 @@ Frame {
chat = Chat {
archived = true
dontNotifyForMentionsIfMuted = true
expirationTimerMs = 937018508425176998
expirationTimerMs = 145232483000
id = 3
markedUnread = true
muteUntilMs = 6481873439951717697
recipientId = 2
muteUntilMs = 1864331637697
recipientId = 4
style = ChatStyle {
bubbleColorPreset = BubbleColorPreset.SOLID_BLUE
dimWallpaperInDarkMode = true
Expand Down
Binary file modified test-cases/chat_09.binproto
Binary file not shown.
2 changes: 1 addition & 1 deletion test-cases/chat_09.txtproto
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ Frame {
chat = Chat {
id = 3
pinnedOrder = 1
recipientId = 2
recipientId = 4
style = ChatStyle {
bubbleColorPreset = BubbleColorPreset.SOLID_INDIGO
wallpaperPreset = WallpaperPreset.SOLID_COPPER
Expand Down
Binary file modified test-cases/chat_10.binproto
Binary file not shown.
6 changes: 3 additions & 3 deletions test-cases/chat_10.txtproto
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,11 @@ Frame {
chat = Chat {
archived = true
dontNotifyForMentionsIfMuted = true
expirationTimerMs = 5826213532931346611
expirationTimerMs = 296226146000
id = 3
markedUnread = true
muteUntilMs = 3788253560711682182
recipientId = 2
muteUntilMs = 1723689901182
recipientId = 4
style = ChatStyle {
bubbleColorPreset = BubbleColorPreset.SOLID_VIOLET
dimWallpaperInDarkMode = true
Expand Down
Binary file modified test-cases/chat_11.binproto
Binary file not shown.
6 changes: 3 additions & 3 deletions test-cases/chat_11.txtproto
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,11 @@ Frame {

Frame {
chat = Chat {
expirationTimerMs = 937018508425176998
expirationTimerMs = 145232483000
id = 3
muteUntilMs = 6481873439951717697
muteUntilMs = 1864331637697
pinnedOrder = 1
recipientId = 2
recipientId = 4
style = ChatStyle {
bubbleColorPreset = BubbleColorPreset.SOLID_PLUM
wallpaperPreset = WallpaperPreset.SOLID_CELADON
Expand Down
Binary file modified test-cases/chat_12.binproto
Binary file not shown.
2 changes: 1 addition & 1 deletion test-cases/chat_12.txtproto
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ Frame {
dontNotifyForMentionsIfMuted = true
id = 3
markedUnread = true
recipientId = 2
recipientId = 4
style = ChatStyle {
bubbleColorPreset = BubbleColorPreset.SOLID_TAUPE
dimWallpaperInDarkMode = true
Expand Down
Binary file modified test-cases/chat_13.binproto
Binary file not shown.
6 changes: 3 additions & 3 deletions test-cases/chat_13.txtproto
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,11 @@ Frame {

Frame {
chat = Chat {
expirationTimerMs = 5826213532931346611
expirationTimerMs = 296226146000
id = 3
muteUntilMs = 3788253560711682182
muteUntilMs = 1723689901182
pinnedOrder = 1
recipientId = 2
recipientId = 4
style = ChatStyle {
bubbleColorPreset = BubbleColorPreset.SOLID_STEEL
wallpaperPreset = WallpaperPreset.SOLID_PACIFIC
Expand Down
Binary file modified test-cases/chat_14.binproto
Binary file not shown.
6 changes: 3 additions & 3 deletions test-cases/chat_14.txtproto
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,11 @@ Frame {
chat = Chat {
archived = true
dontNotifyForMentionsIfMuted = true
expirationTimerMs = 937018508425176998
expirationTimerMs = 145232483000
id = 3
markedUnread = true
muteUntilMs = 6481873439951717697
recipientId = 2
muteUntilMs = 1864331637697
recipientId = 4
style = ChatStyle {
bubbleColorPreset = BubbleColorPreset.GRADIENT_EMBER
dimWallpaperInDarkMode = true
Expand Down
Binary file modified test-cases/chat_15.binproto
Binary file not shown.
2 changes: 1 addition & 1 deletion test-cases/chat_15.txtproto
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ Frame {
chat = Chat {
id = 3
pinnedOrder = 1
recipientId = 2
recipientId = 4
style = ChatStyle {
bubbleColorPreset = BubbleColorPreset.GRADIENT_MIDNIGHT
wallpaperPreset = WallpaperPreset.SOLID_NAVY
Expand Down
Binary file modified test-cases/chat_16.binproto
Binary file not shown.
6 changes: 3 additions & 3 deletions test-cases/chat_16.txtproto
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,11 @@ Frame {
chat = Chat {
archived = true
dontNotifyForMentionsIfMuted = true
expirationTimerMs = 5826213532931346611
expirationTimerMs = 296226146000
id = 3
markedUnread = true
muteUntilMs = 3788253560711682182
recipientId = 2
muteUntilMs = 1723689901182
recipientId = 4
style = ChatStyle {
bubbleColorPreset = BubbleColorPreset.GRADIENT_INFRARED
dimWallpaperInDarkMode = true
Expand Down
Binary file modified test-cases/chat_17.binproto
Binary file not shown.
6 changes: 3 additions & 3 deletions test-cases/chat_17.txtproto
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,11 @@ Frame {

Frame {
chat = Chat {
expirationTimerMs = 937018508425176998
expirationTimerMs = 145232483000
id = 3
muteUntilMs = 6481873439951717697
muteUntilMs = 1864331637697
pinnedOrder = 1
recipientId = 2
recipientId = 4
style = ChatStyle {
bubbleColorPreset = BubbleColorPreset.GRADIENT_LAGOON
wallpaperPreset = WallpaperPreset.SOLID_PINK
Expand Down
Binary file modified test-cases/chat_18.binproto
Binary file not shown.
2 changes: 1 addition & 1 deletion test-cases/chat_18.txtproto
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ Frame {
dontNotifyForMentionsIfMuted = true
id = 3
markedUnread = true
recipientId = 2
recipientId = 4
style = ChatStyle {
bubbleColorPreset = BubbleColorPreset.GRADIENT_FLUORESCENT
dimWallpaperInDarkMode = true
Expand Down
Binary file modified test-cases/chat_19.binproto
Binary file not shown.
6 changes: 3 additions & 3 deletions test-cases/chat_19.txtproto
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,11 @@ Frame {

Frame {
chat = Chat {
expirationTimerMs = 5826213532931346611
expirationTimerMs = 296226146000
id = 3
muteUntilMs = 3788253560711682182
muteUntilMs = 1723689901182
pinnedOrder = 1
recipientId = 2
recipientId = 4
style = ChatStyle {
bubbleColorPreset = BubbleColorPreset.GRADIENT_BASIL
wallpaperPreset = WallpaperPreset.SOLID_SILVER
Expand Down
Binary file modified test-cases/chat_20.binproto
Binary file not shown.
6 changes: 3 additions & 3 deletions test-cases/chat_20.txtproto
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,11 @@ Frame {
chat = Chat {
archived = true
dontNotifyForMentionsIfMuted = true
expirationTimerMs = 937018508425176998
expirationTimerMs = 145232483000
id = 3
markedUnread = true
muteUntilMs = 6481873439951717697
recipientId = 2
muteUntilMs = 1864331637697
recipientId = 4
style = ChatStyle {
bubbleColorPreset = BubbleColorPreset.GRADIENT_SUBLIME
dimWallpaperInDarkMode = true
Expand Down
Binary file modified test-cases/chat_21.binproto
Binary file not shown.
2 changes: 1 addition & 1 deletion test-cases/chat_21.txtproto
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ Frame {
chat = Chat {
id = 3
pinnedOrder = 1
recipientId = 2
recipientId = 4
style = ChatStyle {
bubbleColorPreset = BubbleColorPreset.GRADIENT_SEA
wallpaperPreset = WallpaperPreset.GRADIENT_NOIR
Expand Down
Binary file modified test-cases/chat_22.binproto
Binary file not shown.
6 changes: 3 additions & 3 deletions test-cases/chat_22.txtproto
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,11 @@ Frame {
chat = Chat {
archived = true
dontNotifyForMentionsIfMuted = true
expirationTimerMs = 5826213532931346611
expirationTimerMs = 296226146000
id = 3
markedUnread = true
muteUntilMs = 3788253560711682182
recipientId = 2
muteUntilMs = 1723689901182
recipientId = 4
style = ChatStyle {
bubbleColorPreset = BubbleColorPreset.GRADIENT_TANGERINE
dimWallpaperInDarkMode = true
Expand Down
Binary file modified test-cases/chat_23.binproto
Binary file not shown.
6 changes: 3 additions & 3 deletions test-cases/chat_23.txtproto
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,11 @@ Frame {

Frame {
chat = Chat {
expirationTimerMs = 937018508425176998
expirationTimerMs = 145232483000
id = 3
muteUntilMs = 6481873439951717697
muteUntilMs = 1864331637697
pinnedOrder = 1
recipientId = 2
recipientId = 4
style = ChatStyle {
customColorId = 1
wallpaperPreset = WallpaperPreset.GRADIENT_AQUA
Expand Down
Binary file modified test-cases/chat_24.binproto
Binary file not shown.
2 changes: 1 addition & 1 deletion test-cases/chat_24.txtproto
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ Frame {
dontNotifyForMentionsIfMuted = true
id = 3
markedUnread = true
recipientId = 2
recipientId = 4
style = ChatStyle {
customColorId = 2
dimWallpaperInDarkMode = true
Expand Down
Binary file modified test-cases/chat_25.binproto
Binary file not shown.
6 changes: 3 additions & 3 deletions test-cases/chat_25.txtproto
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,11 @@ Frame {

Frame {
chat = Chat {
expirationTimerMs = 5826213532931346611
expirationTimerMs = 296226146000
id = 3
muteUntilMs = 3788253560711682182
muteUntilMs = 1723689901182
pinnedOrder = 1
recipientId = 2
recipientId = 4
style = ChatStyle {
customColorId = 3
wallpaperPreset = WallpaperPreset.GRADIENT_MONSTERA
Expand Down
Binary file modified test-cases/chat_26.binproto
Binary file not shown.
Loading

0 comments on commit 995dbdb

Please sign in to comment.