Skip to content

Commit

Permalink
[doc] Add a basic doc explaining how to run Taichi CPP tests (#2502)
Browse files Browse the repository at this point in the history
* [doc] Add a basic doc explaining how to run Taichi CPP tests

* Auto Format

* Update docs/lang/articles/contribution/writing_cpp_tests.md

Co-authored-by: Taichi Gardener <[email protected]>
  • Loading branch information
k-ye and taichi-gardener authored Jul 8, 2021
1 parent a584008 commit f276de4
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions docs/lang/articles/contribution/writing_cpp_tests.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
sidebar_position: 11
---

# Workflow for writing a CPP test

We strongly recommend each developer to write CPP unit tests when sending a PR.

- We use [googletest](https://github.com/google/googletest) as the CPP
test infrastructure.
- CPP tests should be added to the `tests/cpp/` directory.

## Build and run Taichi CPP tests

```bash
# inside build/
cmake .. -DTI_BUILD_TESTS=ON # ... other regular Taichi cmake args
make

# run the CPP test
./taichi_cpp_tests
```

:::note
Consider polishing the CPP test infrastructure:

* Separate each translation unit into its own test executable
* Have a unified script to control the execution of which set of tests
:::

## Adding a new test case

Please follow [Googletest Primer](https://google.github.io/googletest/primer.html) and [Advanced googletest Topics](https://google.github.io/googletest/advanced.html).

0 comments on commit f276de4

Please sign in to comment.