<commit_before>package com.stefanodacchille.playground

import org.jetbrains.spek.api.Spek
import kotlin.test.assertEquals

class DisplayNumberSpecs : Spek() {

  init {
    given("a display number") {

      on("displaying a positive number") {
        val number = DisplayNumber(value = "123").toDisplay()
        it("should return positive number") {
          assertEquals("123", number)
        }
        val percentageNumber = DisplayNumber(value = "123", percent = 1).toDisplay()
        it("should return percentage number") {
          assertEquals("1.23", percentageNumber)
        }
      }

      on("displaying a negative number") {
        val number = DisplayNumber(negative = true, value = "123").toDisplay()
        it("should return negative number") {
          assertEquals("-123", number)
        }
        val percentageNumber = DisplayNumber(negative = true, value = "123", percent = 2).toDisplay()
        it("should return negative percentage number") {
          assertEquals("-0.0123", percentageNumber)
        }
      }

      on("displaying not a number") {
        it("should display error message") {
          assertEquals("Not a number", DisplayNumber.fromDecimal(Double.NaN).toDisplay())
        }
      }

      on("displaying infinity") {
        it("should display error message") {
          val errorMessage = "You asked me too much"
          assertEquals(errorMessage,
              DisplayNumber.fromDecimal(Double.POSITIVE_INFINITY).toDisplay())
          assertEquals(errorMessage,
              DisplayNumber.fromDecimal(Double.NEGATIVE_INFINITY).toDisplay())
        }
      }
    }
  }
}<commit_msg>Test re-wording<commit_after>package com.stefanodacchille.playground

import org.jetbrains.spek.api.Spek
import kotlin.test.assertEquals

class DisplayNumberSpecs : Spek() {

  init {
    given("a display number") {

      on("representing a positive number") {
        val number = DisplayNumber(value = "123").toDisplay()
        it("should display positive number") {
          assertEquals("123", number)
        }
        val percentageNumber = DisplayNumber(value = "123", percent = 1).toDisplay()
        it("should display a positive decimal number") {
          assertEquals("1.23", percentageNumber)
        }
      }

      on("representing zero") {
        it("should display zero") {
          assertEquals("0", DisplayNumber.zero.toDisplay())
        }
      }

      on("representing a negative number") {
        val number = DisplayNumber(negative = true, value = "123").toDisplay()
        it("should display negative number") {
          assertEquals("-123", number)
        }
        val percentageNumber = DisplayNumber(negative = true, value = "123", percent = 2).toDisplay()
        it("should display a negative decimal number") {
          assertEquals("-0.0123", percentageNumber)
        }
      }

      on("representing not a number") {
        it("should display an error message") {
          assertEquals("Not a number", DisplayNumber.fromDecimal(Double.NaN).toDisplay())
        }
      }

      on("representing infinity") {
        it("should display an error message") {
          val errorMessage = "You asked me too much"
          assertEquals(errorMessage,
              DisplayNumber.fromDecimal(Double.POSITIVE_INFINITY).toDisplay())
          assertEquals(errorMessage,
              DisplayNumber.fromDecimal(Double.NEGATIVE_INFINITY).toDisplay())
        }
      }
    }
  }
}
{'fraction_non_alphanumeric': 0.11418685121107267, 'fraction_numerical': 0.01643598615916955, 'mean_word_length': 2.496975806451613, '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': '2278597', 'n_tokens_mistral': 948, 'n_tokens_neox': 892, 'n_words': 211}