Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
mattiasgeniar committed May 9, 2020
1 parent db8d528 commit 6d757f5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,11 @@ Percentage::changeBetween(100, 120); // 20%

// How much is $a in relation to $b?
Percentage::percentageOf(120, 100); // 120%
Percentage::percentageOf(50, 100); // 50%

// What is $b percentage of $a?
Percentage::fromNumber(200, 20); // 40%
Percentage::fromNumber(200, 20); // 40
Percentage::fromNumber(200, 50); // 100
```

## Testing
Expand Down
2 changes: 2 additions & 0 deletions tests/PercentageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ public function it_can_get_the_percentage_value_of_a_number()
{
$this->assertEquals(40, Percentage::fromNumber(200, 20));

$this->assertEquals(100, Percentage::fromNumber(200, 50));

$this->assertEquals(-40, Percentage::fromNumber(200, -20));
}
}

0 comments on commit 6d757f5

Please sign in to comment.