Skip to content

Commit f276de4

Browse files
[doc] Add a basic doc explaining how to run Taichi CPP tests (#2502)
* [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]>
1 parent a584008 commit f276de4

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
---
2+
sidebar_position: 11
3+
---
4+
5+
# Workflow for writing a CPP test
6+
7+
We strongly recommend each developer to write CPP unit tests when sending a PR.
8+
9+
- We use [googletest](https://github.com/google/googletest) as the CPP
10+
test infrastructure.
11+
- CPP tests should be added to the `tests/cpp/` directory.
12+
13+
## Build and run Taichi CPP tests
14+
15+
```bash
16+
# inside build/
17+
cmake .. -DTI_BUILD_TESTS=ON # ... other regular Taichi cmake args
18+
make
19+
20+
# run the CPP test
21+
./taichi_cpp_tests
22+
```
23+
24+
:::note
25+
Consider polishing the CPP test infrastructure:
26+
27+
* Separate each translation unit into its own test executable
28+
* Have a unified script to control the execution of which set of tests
29+
:::
30+
31+
## Adding a new test case
32+
33+
Please follow [Googletest Primer](https://google.github.io/googletest/primer.html) and [Advanced googletest Topics](https://google.github.io/googletest/advanced.html).

0 commit comments

Comments
 (0)