Skip to content

test: Add more unit tests for add_to_list. - #2531

Merged
iphydf merged 1 commit into
TokTok:masterfrom
iphydf:add-to-list-test
Jan 10, 2024
Merged

test: Add more unit tests for add_to_list.#2531
iphydf merged 1 commit into
TokTok:masterfrom
iphydf:add-to-list-test

Conversation

@iphydf

@iphydf iphydf commented Jan 9, 2024

Copy link
Copy Markdown
Member

This change is Reviewable

@iphydf iphydf added this to the v0.2.19 milestone Jan 9, 2024
@iphydf
iphydf force-pushed the add-to-list-test branch 3 times, most recently from 6f9aeed to c4f92bf Compare January 9, 2024 18:36
@iphydf
iphydf force-pushed the add-to-list-test branch 5 times, most recently from a754eff to f229de2 Compare January 9, 2024 19:16
@iphydf
iphydf marked this pull request as ready for review January 9, 2024 19:18
Comment thread toxcore/DHT_test.cc Outdated
@iphydf
iphydf force-pushed the add-to-list-test branch 3 times, most recently from 4f43c3b to a910f04 Compare January 10, 2024 00:11
@iphydf
iphydf requested a review from a team as a code owner January 10, 2024 00:11
@iphydf
iphydf force-pushed the add-to-list-test branch 5 times, most recently from 02ecdb9 to 9b2241e Compare January 10, 2024 00:26
@pull-request-attention pull-request-attention Bot assigned Green-Sky and unassigned iphydf Jan 10, 2024
@iphydf
iphydf force-pushed the add-to-list-test branch 2 times, most recently from c378cf2 to b4d7bf4 Compare January 10, 2024 00:38
@iphydf
iphydf force-pushed the add-to-list-test branch 3 times, most recently from 5e56eba to c68aeac Compare January 10, 2024 00:52
@codecov

codecov Bot commented Jan 10, 2024

Copy link
Copy Markdown

Codecov Report

Attention: 58 lines in your changes are missing coverage. Please review.

Comparison is base (05ce5c1) 68.97% compared to head (afc38f2) 69.12%.

Files Patch % Lines
toxcore/DHT_test.cc 70.53% 33 Missing ⚠️
toxcore/crypto_core_test_util.cc 50.00% 11 Missing ⚠️
toxcore/network_test_util.cc 65.38% 9 Missing ⚠️
toxcore/DHT_test_util.cc 63.63% 4 Missing ⚠️
toxcore/test_util_test.cc 96.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2531      +/-   ##
==========================================
+ Coverage   68.97%   69.12%   +0.14%     
==========================================
  Files          89       96       +7     
  Lines       27784    27983     +199     
==========================================
+ Hits        19164    19343     +179     
- Misses       8620     8640      +20     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@iphydf
iphydf force-pushed the add-to-list-test branch 2 times, most recently from 22db489 to 8d3f656 Compare January 10, 2024 01:03
@nurupo

nurupo commented Jan 10, 2024

Copy link
Copy Markdown
Member

toxcore/crypto_core_test_util.cc line 51 at r2 (raw file):

{
    Test_Random *self = static_cast<Test_Random *>(obj);
    return static_cast<uint32_t>(simple_rng(self->seed)) % upper_bound;

Nit: modulo doesn't result in a uniform distribution, it gets skewed. Might not matter for testing though.
C++' random library has random number generators andstd::uniform_int_distribution() too, wonder why they weren't used here.

@iphydf iphydf left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 0 of 1 approvals obtained (waiting on @Green-Sky and @nurupo)


toxcore/crypto_core_test_util.cc line 51 at r2 (raw file):

Previously, nurupo wrote…

Nit: modulo doesn't result in a uniform distribution, it gets skewed. Might not matter for testing though.
C++' random library has random number generators andstd::uniform_int_distribution() too, wonder why they weren't used here.

Added a comment. I'll test/benchmark the C++ stdlib stuff later. For now, this is a very simple and fast implementation intended to be exactly that.

@iphydf iphydf left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 0 of 1 approvals obtained (waiting on @Green-Sky and @nurupo)


toxcore/crypto_core_test_util.cc line 51 at r2 (raw file):

Previously, iphydf wrote…

Added a comment. I'll test/benchmark the C++ stdlib stuff later. For now, this is a very simple and fast implementation intended to be exactly that.

I guess LCG is the same as I put above. Maybe I'll refactor it tomorrow, or otherwise it'll be done in the next round of refactorings.

@iphydf
iphydf force-pushed the add-to-list-test branch 3 times, most recently from ea3a53c to 00c81fb Compare January 10, 2024 01:43

@iphydf iphydf left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 0 of 1 approvals obtained (waiting on @Green-Sky and @nurupo)


toxcore/crypto_core_test_util.cc line 51 at r2 (raw file):

Previously, iphydf wrote…

I guess LCG is the same as I put above. Maybe I'll refactor it tomorrow, or otherwise it'll be done in the next round of refactorings.

I've decided to use C++ :P. Done.

@nurupo
nurupo requested a review from Green-Sky January 10, 2024 01:59

@nurupo nurupo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 2 of 2 files at r8, all commit messages.
Reviewable status: 0 of 1 approvals obtained (waiting on @Green-Sky)

@nurupo

nurupo commented Jan 10, 2024

Copy link
Copy Markdown
Member

FYI was just pointing out something I noticed while skimming through the PR, don't plan on seriously reviewing it so don't hold the PR waiting on my review approval.

@iphydf
iphydf merged commit afc38f2 into TokTok:master Jan 10, 2024
@iphydf
iphydf deleted the add-to-list-test branch January 10, 2024 11:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants