Skip to content

Commit

Permalink
Fix maximum wages of 9,999,999.99 being invalid (#42)
Browse files Browse the repository at this point in the history
  • Loading branch information
georgeherby authored May 28, 2020
1 parent 023f64c commit 8869d9c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@ object WageValidator {

fun isAboveMinimumWages(wages: Double) = wages > 0

fun isBelowMaximumWages(wages: Double) = wages < 9999999.99
fun isBelowMaximumWages(wages: Double) = wages <= 9999999.99
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,20 @@ class WageValidatorTests {
}

@Test
fun `Validate wages below max`() {
fun `Validate wages below max no decimal`() {
assertTrue(WageValidator.isBelowMaximumWages(9999999.0))
}

@Test
fun `Validate wages below max with decimal`() {
assertTrue(WageValidator.isBelowMaximumWages(9999999.99))
}

@Test
fun `Validate wages below max with decimal but 3 places`() {
assertFalse(WageValidator.isBelowMaximumWages(9999999.991))
}

@Test
fun `Validate wages above max`() {
assertFalse(WageValidator.isBelowMaximumWages(10000000.0))
Expand Down

0 comments on commit 8869d9c

Please sign in to comment.