Page MenuHomePhabricator

[services] Tunnelbroker - CryptoTools tests.
ClosedPublic

Authored by max on Apr 7 2022, 10:45 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Jul 2, 4:09 AM
Unknown Object (File)
Thu, Jun 27, 1:16 AM
Unknown Object (File)
Tue, Jun 25, 9:45 PM
Unknown Object (File)
Mon, Jun 24, 2:50 AM
Unknown Object (File)
Sat, Jun 22, 12:02 PM
Unknown Object (File)
Fri, Jun 21, 10:41 PM
Unknown Object (File)
Fri, Jun 21, 10:41 PM
Unknown Object (File)
Fri, Jun 21, 10:41 PM

Details

Summary

CryptoTools - is an internal toolset of functions for cryptography.

We perform tests on a rsaVerifyString() function, that checks the verification message signature signed by the public key provided.

Test Plan

Run yarn test-tunnelbroker-service all tests are run and succeed.

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

tomek requested changes to this revision.Apr 8 2022, 12:39 AM
tomek added inline comments.
services/tunnelbroker/test/CryptoToolsTest.cpp
13–36 ↗(On Diff #11206)

It's usually a good practice to have only one assertion in a test. The benefit is that by looking at tests result you exactly know which assertions were violated. Also, when a test has multiple assertion, the execution stops on the first failure and we don't know what would be the result of following assertions.

So please split this test into two.

This revision now requires changes to proceed.Apr 8 2022, 12:39 AM
max added inline comments.
services/tunnelbroker/test/CryptoToolsTest.cpp
13–36 ↗(On Diff #11206)

It's usually a good practice to have only one assertion in a test. The benefit is that by looking at tests result you exactly know which assertions were violated. Also, when a test has multiple assertion, the execution stops on the first failure and we don't know what would be the result of following assertions.

So please split this test into two.

That makes sense to me. Split it into two.

tomek added inline comments.
services/tunnelbroker/test/CryptoToolsTest.cpp
13 ↗(On Diff #11277)

We should be able to use simple tests https://google.github.io/googletest/primer.html#simple-tests instead of fixtures https://google.github.io/googletest/primer.html#same-data-multiple-tests. TEST is used when you don't need to share data between tests and TEST_F when you need that.

This revision is now accepted and ready to land.Apr 11 2022, 5:50 AM
max added inline comments.
services/tunnelbroker/test/CryptoToolsTest.cpp
13 ↗(On Diff #11277)

We should be able to use simple tests https://google.github.io/googletest/primer.html#simple-tests instead of fixtures https://google.github.io/googletest/primer.html#same-data-multiple-tests. TEST is used when you don't need to share data between tests and TEST_F when you need that.

Good catch! Thanks, @palys-swm.

max marked an inline comment as done.

Switched from TEST_F to TEST, because we don't use a fixtures here.

I think it can be landed without re-reviewing, because of such a tiny change.