Skip to content

Switching some unit tests to doctest#5383

Merged
bthomee merged 11 commits intodevelopfrom
vvysokikh1/unit-test-framework-switch
Jun 26, 2025
Merged

Switching some unit tests to doctest#5383
bthomee merged 11 commits intodevelopfrom
vvysokikh1/unit-test-framework-switch

Conversation

@vvysokikh1
Copy link
Copy Markdown
Contributor

@vvysokikh1 vvysokikh1 commented Apr 3, 2025

High Level Overview of Change

This PR is continuation of work done by @thejohnfreeman. We intend to move from our unit tests framework to doctest.

Context of Change

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Refactor (non-breaking change that only restructures code)
  • Performance (increase or change in throughput and/or latency)
  • Tests (you added tests for code that already exists, or your new feature included in this PR)
  • Documentation update
  • Chore (no impact to binary, e.g. .gitignore, formatting, dropping support for older tooling)
  • Release

API Impact

  • Public API: New feature (new methods and/or new fields)
  • Public API: Breaking change (in general, breaking changes should only impact the next api_version)
  • libxrpl change (any change that may affect libxrpl or dependents of libxrpl)
  • Peer protocol change (must be backward compatible or bump the peer protocol version)

@thejohnfreeman
Copy link
Copy Markdown
Contributor

Happy to help with this as I can. Will take a look this evening. Please communicate with me here if there's something you'd like to ask.

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 3, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 79.1%. Comparing base (df6daf0) to head (f6fb86d).
Report is 1 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##           develop   #5383     +/-   ##
=========================================
- Coverage     79.1%   79.1%   -0.0%     
=========================================
  Files          817     816      -1     
  Lines        71705   71605    -100     
  Branches      8240    8240             
=========================================
- Hits         56716   56618     -98     
+ Misses       14989   14987      -2     

see 6 files with indirect coverage changes

Impacted file tree graph

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown
Contributor

@thejohnfreeman thejohnfreeman left a comment

Choose a reason for hiding this comment

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

Tests build and pass on my machine. 👍

conanfile.py Outdated
'external/*',
'include/*',
'src/*',
'tests/*',
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This line is no longer needed if you're using src/tests instead of tests. I still recommend tests as a matter of convention.

@vvysokikh1 vvysokikh1 changed the title [WIP] Switched some unit tests to doctest Switching some unit tests to doctest Apr 24, 2025
@vvysokikh1 vvysokikh1 marked this pull request as ready for review April 24, 2025 15:21
@bthomee bthomee requested a review from a1q123456 May 21, 2025 17:59
${build_dir}/rippled --unittest --unittest-jobs $(nproc)
cd ${build_dir}
./rippled --unittest --unittest-jobs $(nproc)
ctest -j $(nproc)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'd suggest adding --output-on-failure so that we can get more meaningful logs if a test case fails

@@ -0,0 +1,4 @@
# Unit tests
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Under the src folder, there's a test folder and a tests folder. do we want to merge them? it doesn't look so clean to me

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

this is temporary structure. We want to gradually rewrite tests using rippled's own test framework to use doctest. Those re-written tests are going into tests folder. Older tests remain in their current test folder for now. Some day in the future when we move all tests to new framework, old test folder will be deleted. I've made a readme describing this approach but I understand this is still confusing. I'm open to better options

@bthomee
Copy link
Copy Markdown
Collaborator

bthomee commented Jun 20, 2025

@vvysokikh1 can you please address the review comments & resolve the conflicts? This change would be perfect for the next release.

@vvysokikh1 vvysokikh1 force-pushed the vvysokikh1/unit-test-framework-switch branch from 6319dec to 9257c9b Compare June 23, 2025 10:37
@vvysokikh1
Copy link
Copy Markdown
Contributor Author

@vvysokikh1 can you please address the review comments & resolve the conflicts? This change would be perfect for the next release.

Comments addressed

@bthomee bthomee requested a review from a1q123456 June 23, 2025 17:53
@bthomee bthomee enabled auto-merge (squash) June 26, 2025 18:57
@bthomee bthomee merged commit e18f27f into develop Jun 26, 2025
5 checks passed
@bthomee bthomee deleted the vvysokikh1/unit-test-framework-switch branch June 26, 2025 19:35
ximinez added a commit that referenced this pull request Jul 21, 2025
…refactoring-1

* upstream/develop: (56 commits)
  Remove `include(default)` from libxrpl profile (#5587)
  refactor: Change boost::shared_mutex to std::shared_mutex (#5576)
  Fix macos runner (#5585)
  Remove the type filter from "ledger" RPC command (#4934)
  refactor: Update date, libarchive, nudb, openssl, sqlite3, xxhash packages (#5567)
  test: Run unit tests regardless of 'Supported' amendment status (#5537)
  Retire Flow Cross amendment (#5562)
  chore: Update CI to use Conan 2 (#5556)
  fixAMMClawbackRounding: adjust last holder's LPToken balance (#5513)
  chore: Add gcc-12 workaround (#5554)
  Add MPT related txns into issuer's account history  (#5530)
  chore: Remove unused headers (#5526)
  fix: add allowTrustLineLocking flag for account_info (#5525)
  Downgrade required CMake version for Antithesis SDK (#5548)
  fix: Link with boost libraries explicitly (#5546)
  chore: Fix compilation error with clang-20 and cleanup (#5543)
  test: Remove circular jtx.h dependencies (#5544)
  Decouple CredentialHelpers from xrpld/app/tx (#5487)
  fix: crash when trace-logging in tests (#5529)
  test: switch some unit tests to doctest (#5383)
  ...
This was referenced Aug 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants