diff options
author | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
---|---|---|
committer | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
commit | bcb704366cb5e333a626c18c308c7e0448a8e69f (patch) | |
tree | f0d6ab7d78ecdd9207cf46536376b44b91a1ca71 /kopete/protocols/oscar/liboscar/tests/ipaddrtest.cpp | |
download | tdenetwork-bcb704366cb5e333a626c18c308c7e0448a8e69f.tar.gz tdenetwork-bcb704366cb5e333a626c18c308c7e0448a8e69f.zip |
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdenetwork@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kopete/protocols/oscar/liboscar/tests/ipaddrtest.cpp')
-rw-r--r-- | kopete/protocols/oscar/liboscar/tests/ipaddrtest.cpp | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/kopete/protocols/oscar/liboscar/tests/ipaddrtest.cpp b/kopete/protocols/oscar/liboscar/tests/ipaddrtest.cpp new file mode 100644 index 00000000..4f4e8df2 --- /dev/null +++ b/kopete/protocols/oscar/liboscar/tests/ipaddrtest.cpp @@ -0,0 +1,58 @@ +//Licensed under the GNU General Public License + +#include <iostream> +#include "ipaddrtest.h" +#include <qstring.h> + +using namespace std; +IPAddrTest::IPAddrTest(int argc, char ** argv) +: QApplication( argc, argv ) +{ +} + +IPAddrTest::~IPAddrTest() +{ +} + +bool IPAddrTest::testDottedDecimal() +{ + DWORD address = 1096652712; + return ( Oscar::getDottedDecimal( address ) == "65.93.151.168" ); +} + +bool IPAddrTest::testAllZeroDotted() +{ + DWORD address = 0; + return ( Oscar::getDottedDecimal( address ) == "0.0.0.0" ); +} + +bool IPAddrTest::testNumericalIP() +{ + QString address = "65.93.151.168"; + return ( Oscar::getNumericalIP( address ) == 1096652712 ); +} + +bool IPAddrTest::testAllZeroNumerical() +{ + QString address = "0.0.0.0"; + return ( Oscar::getNumericalIP( address ) == 0 ); +} + +void IPAddrTest::CheckTest(bool TestPassed) +{ + if ( TestPassed ) + cout << "passed" << endl; + else + cout << "failed" << endl; +} + +int main(int argc, char ** argv) +{ + IPAddrTest a( argc, argv ); + + a.CheckTest(a.testDottedDecimal()); + a.CheckTest(a.testNumericalIP()); + a.CheckTest(a.testAllZeroDotted() ); + a.CheckTest( a.testAllZeroNumerical() ); +} + |