smoltcp-rs / smoltcp

a smol tcp/ip stack
BSD Zero Clause License
3.64k stars 404 forks source link

Remove mock for tests #823

Closed thvdveld closed 11 months ago

thvdveld commented 11 months ago

mock was configured at compile time by feature flags. However, this is not very handy when using fixtures. I removed the mock function and added fixtures where needed. For the tests I had to make inner in Interface public for the crate.

This PR also sneeks in a fix for a feature flag combination that did not compile: std,medium-ieee802154,medium-ip,proto-ipv4,socket-raw. With these feature flags, the lookup_hardware_address is called, however, we did not check that the medium for the IPv4 case in there.

codecov[bot] commented 11 months ago

Codecov Report

Merging #823 (7044bd1) into main (fa7fd3c) will decrease coverage by 0.86%. The diff coverage is 90.50%.

@@            Coverage Diff             @@
##             main     #823      +/-   ##
==========================================
- Coverage   79.65%   78.79%   -0.86%     
==========================================
  Files          72       72              
  Lines       27862    27008     -854     
==========================================
- Hits        22193    21281     -912     
- Misses       5669     5727      +58     
Files Changed Coverage Δ
src/iface/neighbor.rs 98.00% <ø> (ø)
src/iface/interface/mod.rs 45.63% <38.46%> (-4.00%) :arrow_down:
src/socket/raw.rs 73.84% <63.63%> (-11.27%) :arrow_down:
src/socket/icmp.rs 70.88% <88.88%> (-15.14%) :arrow_down:
src/socket/udp.rs 79.13% <92.30%> (-5.75%) :arrow_down:
src/tests.rs 98.00% <98.00%> (ø)
src/socket/dhcpv4.rs 85.61% <100.00%> (-3.08%) :arrow_down:
src/socket/tcp.rs 96.49% <100.00%> (+<0.01%) :arrow_up:

... and 4 files with indirect coverage changes

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more