source: trunk/src/test/testNetwork.php@ 7841

Last change on this file since 7841 was 7773, checked in by Pieter Naber, 15 years ago

Created interlinks!
Fixed LogHandler to output at the end (so we have a valid KML file)

File size: 1.9 KB
RevLine 
[7768]1<?php
2// Testing /src/inc/Network.class.php
3
4require_once('../inc/Network.class.php');
5
6$ip1 = '172.16.0.245';
7$ip2 = '172.16.0.246';
8$ip3 = '172.16.0.249';
9$network1 = new Network($ip1, 30);
10$network2 = new Network($ip2, 30);
11$network3 = new Network($ip3, 30);
12echo '
13 Address: ' . $ip1 . ' / ' . Network::binIP($ip1) . '<br/>
[7773]14 ' . $network1->toString() . '<br/>
[7768]15 Address: ' . $ip2 . ' / ' . Network::binIP($ip2) . '<br/>
[7773]16 ' . $network2->toString() . '<br/>
[7768]17 Address: ' . $ip3 . ' / ' . Network::binIP($ip3) . '<br/>
[7773]18 ' . $network3->toString() . '<br/>
[7768]19 Compare network 1 by network 1: ' . $network1->compare($network1) . '<br/>
20 Compare network 1 by network 2: ' . $network1->compare($network2) . '<br/>
21 Compare network 1 by network 3: ' . $network1->compare($network3) . '<br/>
22 Compare network 2 by network 1: ' . $network2->compare($network1) . '<br/>
23 Compare network 2 by network 2: ' . $network2->compare($network2) . '<br/>
24 Compare network 2 by network 3: ' . $network2->compare($network3) . '<br/>
25 Compare network 3 by network 1: ' . $network3->compare($network1) . '<br/>
26 Compare network 3 by network 2: ' . $network3->compare($network2) . '<br/>
27 Compare network 3 by network 3: ' . $network3->compare($network3) . '<br/>
28 <br/>
29 Check if IP 1 is in network 1: ' . $network1->inNetwork($ip1) . '<br/>
30 Check if IP 2 is in network 1: ' . $network1->inNetwork($ip2) . '<br/>
31 Check if IP 3 is in network 1: ' . $network1->inNetwork($ip3) . '<br/>
32 Check if IP 1 is in network 2: ' . $network2->inNetwork($ip1) . '<br/>
33 Check if IP 2 is in network 2: ' . $network2->inNetwork($ip2) . '<br/>
34 Check if IP 3 is in network 2: ' . $network2->inNetwork($ip3) . '<br/>
35 Check if IP 1 is in network 3: ' . $network3->inNetwork($ip1) . '<br/>
36 Check if IP 2 is in network 3: ' . $network3->inNetwork($ip2) . '<br/>
37 Check if IP 3 is in network 3: ' . $network3->inNetwork($ip3) . '<br/>';
38?>
Note: See TracBrowser for help on using the repository browser.