Skip to content
This repository has been archived by the owner on May 25, 2019. It is now read-only.

Refactoring toxcore/network #1

Merged
merged 15 commits into from
Jan 11, 2016
Merged

Refactoring toxcore/network #1

merged 15 commits into from
Jan 11, 2016

Conversation

kpp
Copy link
Owner

@kpp kpp commented Jan 8, 2016

I have written implementation-independent tests so they can run both with my lib and the old one. The result of running my tests with the old toxcore is:

    Start 1: core::network
1/1 Test #1: core::network ....................***Failed    0.01 sec
Running main() from gtest_main.cc
[==========] Running 13 tests from 3 test cases.
[----------] Global test environment set-up.
[----------] 9 tests from IP
[ RUN      ] IP.from_string
[       OK ] IP.from_string (0 ms)
[ RUN      ] IP.to_string
[       OK ] IP.to_string (0 ms)
[ RUN      ] IP.ntoa
/home/humbug/2tox/tests/toxcore/test_network.cpp:128: Failure
Value of: ip_ntoa(&ip)
  Actual: "(IP invalid, family 0)"
Expected: "(IP invalid, Address family not supported by protocol)"
[  FAILED  ] IP.ntoa (0 ms)
[ RUN      ] IP.resolve
[       OK ] IP.resolve (5 ms)
[ RUN      ] IP.reset
[       OK ] IP.reset (0 ms)
[ RUN      ] IP.init
[       OK ] IP.init (0 ms)
[ RUN      ] IP.isset
[       OK ] IP.isset (0 ms)
[ RUN      ] IP.equal
[       OK ] IP.equal (0 ms)
[ RUN      ] IP.copy
[       OK ] IP.copy (0 ms)
[----------] 9 tests from IP (6 ms total)

[----------] 3 tests from IP_Port
[ RUN      ] IP_Port.isset
[       OK ] IP_Port.isset (0 ms)
[ RUN      ] IP_Port.equal
[       OK ] IP_Port.equal (0 ms)
[ RUN      ] IP_Port.copy
[       OK ] IP_Port.copy (0 ms)
[----------] 3 tests from IP_Port (0 ms total)

[----------] 1 test from Socket
[ RUN      ] Socket.valid
[       OK ] Socket.valid (0 ms)
[----------] 1 test from Socket (0 ms total)

[----------] Global test environment tear-down
[==========] 13 tests from 3 test cases ran. (6 ms total)
[  PASSED  ] 12 tests.
[  FAILED  ] 1 test, listed below:
[  FAILED  ] IP.ntoa

 1 FAILED TEST
  YOU HAVE 3 DISABLED TESTS



0% tests passed, 1 tests failed out of 1

Total Test time (real) =   0.01 sec

The following tests FAILED:
      1 - core::network (Failed)

1 fail is a little improvement of error messaging. The other 3 are segfaults caused by incorrect handling of pointers(they are not checked against null in the old implementation).

@kpp kpp force-pushed the refactoring/toxcore_network branch 7 times, most recently from a2e3226 to 5393188 Compare January 8, 2016 20:15
@kpp kpp force-pushed the refactoring/toxcore_network branch from 5393188 to c61edf0 Compare January 8, 2016 20:22
@kpp kpp force-pushed the refactoring/toxcore_network branch 2 times, most recently from 16f3cfb to 3e9bba4 Compare January 9, 2016 13:45
@kpp kpp force-pushed the refactoring/toxcore_network branch from 3e9bba4 to 0785a7e Compare January 9, 2016 14:55
@kpp kpp assigned kpp and 0x7CFE and unassigned kpp Jan 10, 2016
kpp added a commit that referenced this pull request Jan 11, 2016
@kpp kpp merged commit 5cddf62 into develop Jan 11, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants