Skip to content

Commit

Permalink
v1.2.0
Browse files Browse the repository at this point in the history
Prepare tagged release.
  • Loading branch information
Maikuolan committed Jan 9, 2019
1 parent fec38f7 commit 604bd77
Show file tree
Hide file tree
Showing 2 changed files with 88 additions and 3 deletions.
16 changes: 14 additions & 2 deletions Changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,25 @@ Aggregator Changelog.
=== VERSIONING GUIDELINES ===
Aggregator adheres to the SemVer guidelines for versioning.

Versioning guidelines for SemVer can be found at: http://www.semver.org/
Versioning guidelines for SemVer can be found at: https://semver.org/

=== Changes made since last versioned release ===

- [2017.10.08; Sub-minor code change; Maikuolan]: Slightly refactored the
(none)

=== Version/Release 1.2.0 ===
MINOR RELEASE.

- [2018.05.16; Sub-minor code change; Maikuolan]: Slightly refactored the
expressions used for expanding IP addresses.

- [2019.01.09; Maikuolan]: Aggregator now sorts its input differently, as such
that IPv4 and IPv6 output isn't thoroughly mixed together anymore. Aggregator
now supports netmasks, both as input and as output.

Caleb M (Maikuolan),
January 9, 2019.

=== Version/Release 1.1.0 ===
MINOR RELEASE.

Expand Down
75 changes: 74 additions & 1 deletion tests/AggregatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@

class AggregatorTest extends TestCase
{
public function testInOut()

/** Test Aggregator using CIDR notation as output. */
public function testInOutCIDRs()
{
$TestInput = '127.0.0.1 Some arbitrary single IPs from here
127.0.0.2
Expand Down Expand Up @@ -72,6 +74,77 @@ public function testInOut()
$Aggregated = $Aggregator->aggregate($TestInput);
$ExpectedOutput = str_replace(PHP_EOL, "\n", $ExpectedOutput);

$this->assertEquals($ExpectedOutput, $Aggregated, 'Actual aggregated output does not match expected aggregated output!');
}

/** Test Aggregator using netmask notation as output. */
public function testInOutNetmasks()
{
$TestInput = '127.0.0.1 Some arbitrary single IPs from here
127.0.0.2
127.0.0.3
1::
1::1
1:2:3:4::0
1:2:3:4::1
1:2:3:4::2
1:2:3:4::3
2002::1
127.0.0.4
127.0.0.5
257.0.0.999 Some arbitrary INVALID single IPs from here
555.666.777.888
2002:abcd:efgh::1
10.0.0.0/9 Some arbitrary CIDRs from here
10.128.0.0/9
10.192.0.0/10
11.128.0.0/10
11.192.0.0/10
12.0.0.0/9
12.128.0.0/9
13.0.0.0/9
13.128.0.0/9
192.168.0.0/8 Some arbitrary INVALID CIDRs from here
192.168.0.0/9
192.168.0.0/10
192.168.192.0/10
192.169.0.0/10
192.169.64.0/10
1.2.3.4/255.255.255.254 Some arbitrary netmasks from here
2.3.4.5/255.255.255.255
99.99.99.99/255.255.255.255
99.10.10.0/255.255.255.0
99.10.11.0/255.255.255.0
99.8.0.0/255.252.0.0
11.11.11.11/11.11.11.11 Some arbitrary INVALID netmasks from here
255.255.255.254/1.2.3.4
6.7.8.9/255.255.255.254
88.88.88.88/255.255.254.255
Foobar Some garbage data from here
ASDFQWER!@#$
>>HelloWorld<<
SDFSDFSDF
QWEQWEQWE';
$ExpectedOutput = '1.2.3.4/255.255.255.254
2.3.4.5/255.255.255.255
10.0.0.0/255.0.0.0
11.128.0.0/255.128.0.0
12.0.0.0/254.0.0.0
99.8.0.0/255.252.0.0
99.10.10.0/255.255.254.0
99.99.99.99/255.255.255.255
127.0.0.1/255.255.255.255
127.0.0.2/255.255.255.254
127.0.0.4/255.255.255.254
1::/ffff:ffff:ffff:ffff:ffff:ffff:ffff:fffe:0
1:2:3:4::1/ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff:0
1:2:3:4::2/ffff:ffff:ffff:ffff:ffff:ffff:ffff:fffe:0
2002::1/ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff:0';
$Aggregator = new Aggregator(1);
$Aggregator->Results = true;
$Aggregated = $Aggregator->aggregate($TestInput);
$ExpectedOutput = str_replace(PHP_EOL, "\n", $ExpectedOutput);

$this->NumberEntered = $Aggregator->NumberEntered;
$this->NumberRejected = $Aggregator->NumberRejected;
$this->NumberAccepted = $Aggregator->NumberAccepted;
Expand Down

0 comments on commit 604bd77

Please sign in to comment.