<commit_before>package ciris.refined.readers

import ciris.PropertySpec
import ciris.refined._
import eu.timepit.refined.types.numeric.PosInt

final class RefinedConfigReadersSpec extends PropertySpec {
  "RefinedConfigReaders" when {
    "reading a RefType" should {
      "successfully read RefType values" in {
        readValue[PosInt]("1").right.map(_.value) shouldBe Right(1)
      }

      "return a failure for wrong type" in {
        readValue[PosInt]("0") shouldBe a[Left[_, _]]
      }

      "return a failure for missing key" in {
        readNonExistingValue[PosInt] shouldBe a[Left[_, _]]
      }
    }
  }
}<commit_msg>Improve refined tests<commit_after>package ciris.refined.readers

import ciris.PropertySpec
import ciris.refined._
import eu.timepit.refined.types.numeric.PosInt
import org.scalacheck.Gen

final class RefinedConfigReadersSpec extends PropertySpec {
  "RefinedConfigReaders" when {
    "reading a RefType" should {
      "successfully read RefType values" in {
        forAll(Gen.posNum[Int]) { posInt ⇒
          readValue[PosInt](posInt.toString).right.map(_.value) shouldBe Right(posInt)
        }
      }

      "return a failure for wrong type" in {
        forAll(Gen.choose(Int.MinValue, 0)) { nonPosInt ⇒
          readValue[PosInt](nonPosInt.toString) shouldBe a[Left[_, _]]
        }
      }

      "return a failure for missing key" in {
        readNonExistingValue[PosInt] shouldBe a[Left[_, _]]
      }
    }
  }
}
{'fraction_non_alphanumeric': 0.10252904989747096, 'fraction_numerical': 0.002734107997265892, 'mean_word_length': 3.100840336134454, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '6991197', 'n_tokens_mistral': 476, 'n_tokens_neox': 466, 'n_words': 105}