From b2c95084b0772be68f0105e21c36f3f71b1a1021 Mon Sep 17 00:00:00 2001 From: Kjartan Thor Wikfeldt Date: Fri, 23 Apr 2021 11:45:04 +0200 Subject: [PATCH] add overflow discussion point, fixes #134 --- content/test-design.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/content/test-design.md b/content/test-design.md index 4fa916a..4f4014a 100644 --- a/content/test-design.md +++ b/content/test-design.md @@ -72,7 +72,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} @@ -118,6 +121,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. `````` ```````