Skip to content

Commit

Permalink
Merge pull request #172 from coderefinery/thor/overflow
Browse files Browse the repository at this point in the history
add overflow discussion point, fixes #134
  • Loading branch information
wikfeldt authored Apr 27, 2021
2 parents 4a45922 + b2c9508 commit dfd6bd1
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions content/test-design.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,10 @@ Also discuss why some are easier to test than others.
```{literalinclude} code/factorial.f90
:language: fortran
```
````
Discussion point: The factorial grows very rapidly. What happens if you
pass a large number as argument to the function?
`````
``````{solution}
Expand Down Expand Up @@ -119,6 +122,10 @@ function more fine-grained and test only one concept.
```
````
`````
Notes on the discussion point: Programming languages differ in the way they deal with integer
overflow. Python automatically converts to the necessary `long` type, in Julia you would
observe a "wrap-around", in C/C++ you get undefined behaviour for signed integers.
Testing for overflow likewise depends on the language.
``````
```````

Expand Down

0 comments on commit dfd6bd1

Please sign in to comment.