Skip to content

Commit fba8810

Browse files
BlonyFRryanplusplusBlony
authored
Update 'Exercise Anatomy' in CONTRIBUTING.md (#1248)
* Update 'Exercise Anatomy' in CONTRIBUTING.md * Update 'Exercise Anatomy' in CONTRIBUTING.md * Update 'Exercise Anatomy' in CONTRIBUTING.md * Update CONTRIBUTING.md Typing Error * Update docs/CONTRIBUTING.md Review Co-authored-by: Ryan Hartlage <2488333+ryanplusplus@users.noreply.github.com> * after review * Update docs/CONTRIBUTING.md --------- Co-authored-by: Ryan Hartlage <2488333+ryanplusplus@users.noreply.github.com> Co-authored-by: Blony <blony@Host-001.lan>
1 parent 11bb32e commit fba8810

1 file changed

Lines changed: 22 additions & 26 deletions

File tree

docs/CONTRIBUTING.md

Lines changed: 22 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -77,40 +77,36 @@ clang-format -i $(file)
7777

7878
## Exercise anatomy
7979

80-
Each exercise should be contained in a directory `c/exercises/{exercise-name}`.
80+
Each exercise should be contained in a directory `c/exercises/practice/{exercise-name}`.
8181
See [implement-an-exercise-from-specification][] for in depth details on implementing an exercise that matches the specification
8282

83-
The structure of en exercise directory is as follows (note the differing hyphen and underscore usage for directory names and file names respectively):
83+
The structure of an exercise directory is as follows (note the differing hyphen and underscore usage for directory names and file names respectively):
8484

8585
```text
8686
+-- {exercise-name}
8787
+-- makefile
88-
+-- README.md
89-
+-- src
90-
| +-- example.c
91-
| +-- example.h | {exercise_name}.h
92-
+-- test
93-
+-- test_{exercise_name}.c
94-
+-- vendor
95-
+-- unity.c
96-
+-- unity.h
97-
+-- unity_internals.h
88+
+-- {exercise-name}.c
89+
+-- {exercise-name}.h
90+
+-- test_{exercise-name}.c
91+
+-- test-framework
92+
| +-- unity.c
93+
| +-- unity.h
94+
| +-- unity_internals.h
9895
```
9996

100-
* `test` - contains the test file `test_{exercise_name}.c` and a `vendor` directory containing the test harness [Unity][] from [ThrowTheSwitch][].
101-
ThrowTheSwitch has a decent guide on [getting started with Unity][] should you desire a tutorial.
102-
The version of Unity used is indicated in [versions][]. The layout of the test file is described in the [style guide][test-file-layout].
103-
Tests should be written that satisfy `canonical-data.json` file for the exercise in the [problem-specifications][] repository
104-
* `src` - contains the example files `example.c` and `example.h`.
105-
These are both skipped by the `exercism` CLI when downloading to the client, so it is imperative that you do not reference the names of the files in your code.
106-
If you need to provide a header file example that is necessary to run your tests it should be named `{my_exercise}.h` instead.
107-
Please also use [include guards][] in your header files.
108-
The exercise tests can be run using `make` from the repository root.
109-
The top-level makefile will rename the `example.{c|h}` files accordingly (use `make help` to learn about individual targets).
110-
* `makefile` - is the makefile for the exercise as it would build using proper filenames (i.e. `{exercise_name}.c` and `{exercise_name}.h` instead of `example.c` and `example.h` respectively).
111-
Makefiles are expected to change very little between exercises so it should be easy to copy one from another exercise.
112-
* `README.md` - is the readme that relates to the exercise.
113-
These can be generated by the [configlet][] tool from `description.md` for the exercise in the [problem-specifications][] repository, or alternatively a custom one can be written.
97+
`test_{exercise_name}.c` - This file contains all the tests for the exercise.
98+
`test-framework` - directory containing the test harness [Unity][] from [ThrowTheSwitch][].
99+
ThrowTheSwitch has a decent guide on [getting started with Unity][] should you desire a tutorial.
100+
The version of Unity used is indicated in [versions][]. The layout of the test file is described in the [style guide][test-file-layout].
101+
Tests should be written to satisfy `canonical-data.json` file for the exercise in the [problem-specifications][] repository
102+
`{exercise-name}.c` / `{exercise-name}.h` - The exercise's source files.
103+
Please use [include guards][] in your header files.
104+
The exercise tests can be run using `make test` from the repository root.
105+
* `makefile` - is the makefile for the exercise as it would build.
106+
Two rules are required,
107+
test: compile test_{exercise-name}.c and run it.
108+
memcheck: compile test_{exercise-name} with -fsanitize=address, -fno-common, -fno-omit-frame-pointer flag and run it
109+
Makefiles are expected to change very little between exercises so it should be easy to copy one from another exercise.
114110

115111
**Don't forget** to add the exercise to the track's `config.json`. For this you will need to determine the best place to add the exercise within the order of all other track exercises. You will also need to generate a UUID to add here. For both of these tasks you can use the [configlet][] tool; the tool will even lint and format the `config.json` for you after you've made these changes!
116112

0 commit comments

Comments
 (0)