Patryk27 / website

Source code for pwy.io

Home Page:https://pwy.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[LtF - Pt 2] Fix last test case

Mirclus opened this issue · comments

Hi,

The last testcase show in this article won't succeed, you will get 2 failed asserts:

  • The first propagate will assert, as the input (1 value) does not match the weights (2)
  • The second assert fails, because propagate cannot return negative values (so the result is 0).

Additionally, as you are already using a struct for the topology, you could also use std::num::NonZeroUsize.

Otherwise, good post, keep up the good work.

Hi,

You've got quite an eye - I fixed the code example :-)
As for the NonZeroUsize - it's a great tip, I'll try introducing it in the third part.

Thanks!