test: re-implement tests

Reimplement the tests of music modeling, and re-enable the automatic
test workflow in GH actions.

I'm actually going to work on reimplementing these.
This commit is contained in:
Alexander Capehart
2023-08-18 11:54:47 -06:00
parent 2c2bd79ae2
commit 59e42acad9
16 changed files with 567 additions and 790 deletions
@@ -20,6 +20,7 @@ package org.oxycblt.auxio.music.info
import android.content.Context
import androidx.annotation.StringRes
import androidx.annotation.VisibleForTesting
import java.text.CollationKey
import java.text.Collator
import org.oxycblt.auxio.music.MusicSettings
@@ -54,10 +55,11 @@ sealed interface Name : Comparable<Name> {
abstract val sort: String?
/** A tokenized version of the name that will be compared. */
protected abstract val sortTokens: List<SortToken>
@VisibleForTesting(VisibleForTesting.PROTECTED) abstract val sortTokens: List<SortToken>
/** An individual part of a name string that can be compared intelligently. */
protected data class SortToken(val collationKey: CollationKey, val type: Type) :
@VisibleForTesting(VisibleForTesting.PROTECTED)
data class SortToken(val collationKey: CollationKey, val type: Type) :
Comparable<SortToken> {
override fun compareTo(other: SortToken): Int {
// Numeric tokens should always be lower than lexicographic tokens.