Skip to content

Commit

Permalink
Add MSVC coverage for Constant and UnitSymbol
Browse files Browse the repository at this point in the history
Some comments on the vcpkg PR to upgrade Au to 0.4.0 made me suspicious
that we lacked coverage here.  I'm going to add it and see if it breaks.
  • Loading branch information
chiphogg committed Dec 18, 2024
1 parent d8cf816 commit 07888fd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/single-file-build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:

- name: Build single-file package
shell: cmd
run: python tools/bin/make-single-file --units meters seconds --version-id NA > au.hh
run: python tools/bin/make-single-file --units meters seconds --constants speed_of_light --version-id NA > au.hh

- name: Build and run test
shell: cmd
Expand Down
3 changes: 3 additions & 0 deletions single-file-test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
// dependencies outside of the C++14 standard library, and the single-file package of Au itself.

using namespace au;
using ::au::symbols::m;
using ::au::symbols::s;

// This ad hoc utility is a stand-in for GTEST, which we can't use here.
template <typename ExpectedT, typename ActualT>
Expand All @@ -42,6 +44,7 @@ int main(int argc, char **argv) {
const std::vector<bool> results{
{
expect_equal((meters / second)(5) * seconds(6), meters(30)),
expect_equal(SPEED_OF_LIGHT.as<int>(m / s), 299'792'458 * m / s),
},
};
return std::all_of(std::begin(results), std::end(results), [](auto x) { return x; }) ? 0 : 1;
Expand Down

0 comments on commit 07888fd

Please sign in to comment.