opensim-org / opensim-core

SimTK OpenSim C++ libraries and command-line applications, and Java/Python wrapping.
https://opensim.stanford.edu
Apache License 2.0
757 stars 307 forks source link

Convert all tests to the `Catch2` framework #3555

Open nickbianco opened 9 months ago

nickbianco commented 9 months ago

Current testing in OpenSim uses a variety of implementations and code styles. Most of the tests for Moco use Catch2, and since the Moco merge, we've been sporadically converting OpenSim tests to this new framework. This epic proposes that we convert all the OpenSim tests to Catch2 to unify the testing suite, speed up development (i.e., isolating and re-running only failed tests), and make adding new tests easy. This should be a "many hands make light work" approach, where we divide up the tests to be converted across several individual issues that separate members of the dev team can tackle.

Tasks

Phase 1: Convert existing code to minimally use Catch

Phase 2: Update any build/contribution guides to mention the change

Phase 3: Improve assertions and test framework usage

Phase 1 CPP todo List

adamkewley commented 9 months ago

List created with hacky script:

import os
import itertools

srcdir = 'C:\\Users\\adamk\\Desktop\\opensim-core\\OpenSim'

all = []
for root, subdirs, files in os.walk(srcdir):
    for file in files:
        if file.lower().startswith('test') and file.lower().endswith('cpp'):
            p = os.path.relpath(os.path.join(root, file), srcdir)
            all.append(p)

for k, g in itertools.groupby(all, lambda el: el.split(os.path.sep)[0]):
    print(f'- [ ] {k}{os.path.sep}')
    for el in g:
        rest = os.path.sep.join(el.split(os.path.sep)[1:])
        print(f'    - [ ] {rest}')
nickbianco commented 9 months ago

@adamkewley I added some tests under /Vendors that your script missed.