Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test client package #360

Merged
merged 3 commits into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions .github/workflows/cmake-client-build-and-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Copyright 2024 Aurora Operations, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

name: cmake-client-build-and-test

on:
push:
branches:
- main
pull_request:

jobs:
cmake-build-and-test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b #v4.1.5
- name: Setup CMake
uses: jwlawson/actions-setup-cmake@802fa1a2c4e212495c05bf94dba2704a92a472be #v2.0.2
with:
cmake-version: '3.29.x'
- name: Generate build files for Au
run: cmake -S . -B cmake/build -DAU_EXCLUDE_GTEST_DEPENDENCY=TRUE -DCMAKE_VERIFY_INTERFACE_HEADER_SETS=TRUE
- name: Build Au
run: cmake --build cmake/build --target all all_verify_interface_header_sets
- name: Install Au
run: cmake --install cmake/build --prefix "$PWD/cmake/install"
- name: Generate build files for client
run: cmake -S . -B build -DCMAKE_PREFIX_PATH="$PWD/../cmake/install"
working-directory: test_package
- name: Build client
run: cmake --build build --target all
working-directory: test_package
- name: Run executable
run: ./build/test_au_client
working-directory: test_package
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/bazel-*
cmake/build*
cmake/install*
test_package/build*
Testing
9 changes: 9 additions & 0 deletions au/code/au/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ header_only_library(
quantity.hh
quantity_point.hh
rep.hh
static_cast_checkers.hh
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The changes in this file are the ones that fix the actual bug.

unit_of_measure.hh
unit_symbol.hh
wrapper_operations.hh
Expand Down Expand Up @@ -465,6 +466,14 @@ gtest_based_test(
au
)

gtest_based_test(
NAME static_cast_checkers_test
SRCS
static_cast_checkers_test.cc
DEPS
au
)

gtest_based_test(
NAME stdx_test
SRCS
Expand Down
23 changes: 23 additions & 0 deletions test_package/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Copyright 2024 Aurora Operations, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

cmake_minimum_required(VERSION 3.29)

project(test_au_client LANGUAGES CXX)

find_package(Au REQUIRED CONFIG)

add_executable(${PROJECT_NAME} test_au_client.cc)
target_link_libraries(${PROJECT_NAME} PRIVATE Au::au)
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14)
33 changes: 33 additions & 0 deletions test_package/test_au_client.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// Copyright 2024 Aurora Operations, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#include <iostream>

#include "au/io.hh"
#include "au/prefix.hh"
#include "au/units/hours.hh"
#include "au/units/meters.hh"
#include "au/units/seconds.hh"

using ::au::symbols::h;
using ::au::symbols::m;
using ::au::symbols::s;
constexpr auto km = ::au::kilo(m);

int main(int argc, char **argv) {
constexpr auto v1 = 1 * m / s;
constexpr auto v2 = 1 * km / h;
std::cout << "(" << v1 << ") + (" << v2 << ") = " << (v1 + v2) << std::endl;
return 0;
}
Loading