Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
got adapted to NUnit 4.
When I started migrating kata to NUnit 4 I wanted to disable the additional output, but i could not find a way. Then I found this article: https://docs.nunit.org/articles/nunit/Towards-NUnit4.html#improved-assert-result-messages and i looked into sources of NUnit 4 and i found no way to control the new output.
Bottom line is that the assertion expression is deliberately meant to use verbatim code and not values, because the goal behind it is easier identifiation of failed assertions in code. Runtime values are still presented as
actual
andexpected
. It works well in "real world" setup, but yeah, for CW can end up too verbose.After a conversation with an AI tool, I finally got the AI to admit this:
@hobovsky:
Is this possible to implement in the C# Codewars test setup?
In NUnit, you can indeed change the default behavior to show runtime values in assertion messages. This can be done by configuring NUnit to use more verbose output. Here's how you can do it:
In your test project, add or modify the file
nunit.runsettings
(or sometimes*.runsettings
).Add the following XML configuration:
The key setting here is
<DefaultAssertionMessageFormat>ShowDifferences</DefaultAssertionMessageFormat>
. This will make NUnit show the actual and expected values in the assertion messages by default.nunit.runsettings
file.After applying these settings, your assertion messages should include the runtime values by default, making debugging easier without needing to modify each individual assertion.
I find this new error message formatting in C# a bit ridiculous. Why can't it just give the runtime values instead :/
It almost the same: find sum from 1 to n, is it?
Got so used to following the standard procedure for you normal binary/hex conversions, this one really made me think about how the math works and how to get from a to b. Was frustrating, but fun!
Hint: for a more general example, take a look at Excel numeration system.
Done in Rust and Go translations.
Approved :)
'could be interesting to have the sample tests split in 2 different sections: one for encoding, and the other for decoding. It's a bit more comfortable for the user.
Clever, though inefficient (conversion takes too much time).
How?
C translation (author gone)
Loading more items...