<commit_before>package justin.db.replication

import justin.consistent_hashing.RingSize
import org.scalacheck.{Gen, Properties}
import org.scalacheck.Prop._

class PreferenceListSpecification extends Properties("PreferenceList") {

  property("head of preference-list is base partitionId") = {
    val ringSize = RingSize(64)
    val n = N(3)
    val paritionIdGen = Gen.choose(0, ringSize.size)

    forAll(paritionIdGen) { baseParitionId: Int =>
      BuildPreferenceList(baseParitionId, n, ringSize).head == baseParitionId
    }
  }
}<commit_msg>add property test that size of preference-list is always the same as configured number of replicas<commit_after>package justin.db.replication

import justin.consistent_hashing.RingSize
import org.scalacheck.{Gen, Properties}
import org.scalacheck.Prop._

class PreferenceListSpecification extends Properties("PreferenceList") {

  property("head of preference-list is initial partitionId") = {
    val ringSize = RingSize(64)
    val n = N(3)
    val partitionIdGen = Gen.choose(0, ringSize.size-1)

    forAll(partitionIdGen) { basePartitionId: Int =>
      BuildPreferenceList(basePartitionId, n, ringSize).head == basePartitionId
    }
  }

  property("size of preference-list is always the same as configured number of replicas") = {
    val ringSize = RingSize(64)
    val basePartitionId = 0
    val replicaNrGen = Gen.choose(0, 1000)

    forAll(replicaNrGen) { n: Int =>
      BuildPreferenceList(basePartitionId, N(n), ringSize).size == n
    }
  }
}
{'fraction_non_alphanumeric': 0.09615384615384616, 'fraction_numerical': 0.011273209549071617, 'mean_word_length': 4.389285714285714, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6892563', 'n_tokens_mistral': 484, 'n_tokens_neox': 459, 'n_words': 116}