fun <T> List<T>.relationshipTo(testList: List<T>): Relationship {
    if (testList == this) {
        return Relationship.EQUAL
    }

    if (this.isSuperlist(testList)){
        return Relationship.SUPERLIST
    }

    if (testList.isSuperlist(this)){
        return Relationship.SUBLIST
    }

    return Relationship.UNEQUAL
}

fun <T> List<T>.isSuperlist(testList: List<T>): Boolean{
    if (testList.isEmpty()){
        return true
    }

    if (this.size < testList.size){
        return false
    }

    if (testList.size >= this.size) {
        if ((this == testList.subList(0, this.size)) or
                (this == testList.subList(testList.size - this.size, testList.size))) {
            return true
        }
    }

    val sizeDelta = this.size - testList.size
    for (i in 0..sizeDelta){
        if (this.subList(i, i + testList.size) == testList){
            return true
        }
    }

    return false
}