Freedom-of-Form-Foundation / anatomy3d

A CAD tool for humanoid anatomy alterations. See the anatomy3d-blender repository for more recent work.
https://freedomofform.org/1856/3d-anatomy-project-scope-phase-1-focus-on-a-limb-joint/
GNU General Public License v2.0
7 stars 5 forks source link

Add the codebase's first-ever unit test: addition with the Real type #31

Closed AdamNorberg closed 3 years ago

AdamNorberg commented 3 years ago

Obviously, this is just a start - there's a lot of behavior in Real and all of it needs to be tested. But, I believe in small, easily-reviewed changes, and this passes, so why not push it in as an example of how an xUnit test looks?

A public method in an xUnit project with a [Fact] annotation is expected to be making "factual assertions" - its assertions should always hold. (A [Theory] is a test that takes parameters, and its assertions are only expected to pass with certain combinations of parameters. You'll see those later.) So, this asserts that simple addition works - as long as my Equals function isn't just returning "yes" all the time. Hm, better check that, too...

AdamNorberg commented 3 years ago

I added tests for .Equals and ==, too, so we can see that the Assert.Equals method is indeed testing something, not just running into an Equals method that always returns true...

AdamNorberg commented 3 years ago

I changed the name, but took no action for the other comments. Give it another look?