I think for small simple modules it's ok to have the tests (with doAssert, not assert) in the same file. Apart from that, I prefer a test module using the [unittest](https://nim-lang.org/docs/unittest.html) module for each module to test.
In my experience, putting the tests in the same file as the tested code makes maintaining the tests awkward if the tests grow. Consequently, tests aren't as thorough as if put into an extra file. Having the tests in an extra file helps me focus more on writing good tests with good coverage.
