From 1dc7784b56b2c12672a5a17ca6c4dbb64cceffe5 Mon Sep 17 00:00:00 2001 From: Lucas Thenert Date: Thu, 26 Jan 2023 18:04:49 +0100 Subject: [PATCH] Funktion Kniffel, alle Wuerfel haben die selbe augenzahl --- kniffel/inc/kniffel.js | 9 +++++++++ kniffel/test/test_kniffel.test.js | 14 ++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 kniffel/inc/kniffel.js create mode 100644 kniffel/test/test_kniffel.test.js diff --git a/kniffel/inc/kniffel.js b/kniffel/inc/kniffel.js new file mode 100644 index 0000000..ba85aeb --- /dev/null +++ b/kniffel/inc/kniffel.js @@ -0,0 +1,9 @@ +function kniffel(w1, w2, w3, w4, w5){ + if(w1 == w2 && w1 == w3 && w1 == w4 && w1 == w5){ + return 50; + } else { + return 0; + } + +} +module.exports = kniffel; diff --git a/kniffel/test/test_kniffel.test.js b/kniffel/test/test_kniffel.test.js new file mode 100644 index 0000000..0aee410 --- /dev/null +++ b/kniffel/test/test_kniffel.test.js @@ -0,0 +1,14 @@ +const kniffel = require('../inc/kniffel'); + + +//Eine Test Gruppe, mit mehreren Tests +describe('tests kniffel', () => { + + it('teste ob alle Wuerfel die selbe Augenzahl haben', ()=>{ + + //Vergleiche Ist- und Sollergebnis + expect(kniffel(3, 4, 6, 1, 2)).toBe(0); + + }); + +})