Skip to content

Tłumaczenie #11

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 48 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,53 @@
# Testowanie

<a href="https://coders.school">
<img width="500" data-src="coders_school_logo.png" src="coders_school_logo.png" alt="Coders School" class="plain">
</a>

## [Moduł 1: Framework `catch2`](module1/presentation_catch.md)
# Testowanie

## [Moduł 1](module1/)

### [Framework `catch2`](module1/00_catch.pl.md)

### [Zadanie domowe](module1/01_homework.pl.md)

## [Moduł 2](module2/)

### [Framework `GTest`](module2/00_gtest.pl.md)

### [Zadanie domowe](module2/01_homework.pl.md)

## [Moduł 3](module3/)

### [Wstrzykiwanie zależności](module3/00_dependency_injection.pl.md)

### [Atrapy](module3/01_test_doubles.pl.md)

### [`GMock`](module3/02_gmock.pl.md)

### [Praca domowa](module3/03_homework.pl.md)

___

# Testing

## [Module 1](module1/)

### [`catch2` framework](module1/00_catch.en.md)

### [Homework](module1/01_homework.en.md)

## [Module 2](module2/)

### [`GTest` framework](module2/00_gtest.en.md)

### [Homework](module2/01_homework.en.md)

## [Module 3](module3/)

### [Dependency injection](module3/00_dependency_injection.en.md)

### [Test doubles](module3/01_test_doubles.en.md)

### [`GMock`](module3/02_gmock.en.md)

## [Moduł 2: Framework `gtest`](module2/presentation_gtest.md)
### [Homework](module3/03_homework.en.md)
74 changes: 74 additions & 0 deletions module1/00_catch.en.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
<!-- .slide: data-background="#111111" -->

# Testing

## `Catch2`framework

<a href="https://coders.school">
<img width="500" data-src="../coders_school_logo.png" alt="Coders School" class="plain">
</a>

___

## Useful assertions

* <!-- .element: class="fragment fade-in" --> <code>REQUIRE( expression )</code>
* <!-- .element: class="fragment fade-in" --> <code>CHECK( expression )</code>
* <!-- .element: class="fragment fade-in" --> <code>REQUIRE_FALSE( expression )</code>
* <!-- .element: class="fragment fade-in" --> <code>CHECK_FALSE( expression )</code>
* <!-- .element: class="fragment fade-in" --> <code>REQUIRE_NOTHROW( expression )</code>
* <!-- .element: class="fragment fade-in" --> <code>CHECK_NOTHROW( expression )</code>
* <!-- .element: class="fragment fade-in" --> <code>REQUIRE_THROWS_AS( expression, exception type )</code>
* <!-- .element: class="fragment fade-in" --> <code>CHECK_THROWS_AS( expression, exception type )</code>
* <!-- .element: class="fragment fade-in" --> <code>REQUIRE_THAT( lhs, matcher expression )</code>
* <!-- .element: class="fragment fade-in" --> <code>CHECK_THAT( lhs, matcher expression )</code>

___

## Useful matchers

* <!-- .element: class="fragment fade-in" --> String matchers
* <!-- .element: class="fragment fade-in" --> <code>StartsWith</code>
* <!-- .element: class="fragment fade-in" --> <code>EndsWith</code>
* <!-- .element: class="fragment fade-in" --> <code>Contains</code>
* <!-- .element: class="fragment fade-in" --> <code>Equals</code>
* <!-- .element: class="fragment fade-in" --> <code>Matches</code>
* <!-- .element: class="fragment fade-in" --> Vector matchers
* <!-- .element: class="fragment fade-in" --> <code>Contains</code> which checks whether a specified vector is present in the result
* <!-- .element: class="fragment fade-in" --> <code>VectorContains</code> which checks whether a specified element is present in the result
* <!-- .element: class="fragment fade-in" --> <code>Equals</code> which checks whether the result is exactly equal (order matters) to a specific vector
* <!-- .element: class="fragment fade-in" --> <code>UnorderedEquals</code> which checks whether the result is equal to a specific vector under a permutation

___

## Exercise

Test the algorithm `std::sort()`.

In this task, it is important to cover as many scenarios of this algorithm as possible.

___

## Organization of tests

* <!-- .element: class="fragment fade-in" --> <code>TEST_CASE( test name [, tags ] )</code>
* <!-- .element: class="fragment fade-in" --> <code>SECTION( section name )</code>

Or
<!-- .element: class="fragment fade-in" -->

* <!-- .element: class="fragment fade-in" --> <code>SCENARIO( scenario name [, tags ] )</code>
* <!-- .element: class="fragment fade-in" --> <code>GIVEN( something )</code>
* <!-- .element: class="fragment fade-in" --> <code>WHEN( something )</code>
* <!-- .element: class="fragment fade-in" --> <code>THEN( something )</code>

Where `SCENARIO` maps to `TEST_CASE`, while `GIVEN`, `WHEN` and `THEN` on `SECTION`.
<!-- .element: class="fragment fade-in" -->

___

## Generators

Thanks to data generators, one test scenario can be run on different test data.

[Link to documentation](https://github.com/catchorg/Catch2/blob/master/docs/generators.md#top)
File renamed without changes.
95 changes: 95 additions & 0 deletions module1/01_homework.en.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
<!-- .slide: data-background="#111111" -->

# Testing

## Homework

<a href="https://coders.school">
<img width="500" data-src="../coders_school_logo.png" alt="Coders School" class="plain">
</a>

___

## SHM - group task

* Write tests for SHM (0 points)
* do not report PR to us 😉 you can show the tests or ask about them on Discord.

___

## Bowling - a new task

Get into new groups. There should be people in the group with whom you haven't cooperated yet 🙂

* Brainstorm and write test scenarios in the GIVEN WHEN THEN format for a program whose task is to count points in bowling. Scenarios are to be written in the Catch2 framework, but do not need to contain any code. You don't even have to implement this program (yet 😉). The point is to cover as much functionality as possible with tests. Description of bowling rules below.
* 1 point for each test scenario. Scenarios covering the same functionality will be counted as one.

___

## Bowling - The scoring rules

```text
Each game, or "line" of bowling, includes ten turns,
or "frames" for the bowler.

In each frame, the bowler gets up to two tries to
knock down all ten pins.

If the first ball in a frame knocks down all ten pins,
this is called a "strike". The frame is over. The score
for the frame is ten plus the total of the pins knocked
down in the next two balls.

If the second ball in a frame knocks down all ten pins,
this is called a "spare". The frame is over. The score
for the frame is ten plus the number of pins knocked
down in the next ball.

If, after both balls, there is still at least one of the
ten pins standing the score for that frame is simply
the total number of pins knocked down in those two balls.

If you get a spare in the last (10th) frame you get one
more bonus ball. If you get a strike in the last (10th)
frame you get two more bonus balls.
These bonus throws are taken as part of the same turn.
If a bonus ball knocks down all the pins, the process
does not repeat. The bonus balls are only used to
calculate the score of the final frame.

The game score is the total of all frame scores.

Examples:

X indicates a strike
/ indicates a spare
- indicates a miss
| indicates a frame boundary
The characters after the || indicate bonus balls

X|X|X|X|X|X|X|X|X|X||XX
Ten strikes on the first ball of all ten frames.
Two bonus balls, both strikes.
Score for each frame == 10 + score for next two
balls == 10 + 10 + 10 == 30
Total score == 10 frames x 30 == 300

9-|9-|9-|9-|9-|9-|9-|9-|9-|9-||
Nine pins hit on the first ball of all ten frames.
Second ball of each frame misses last remaining pin.
No bonus balls.
Score for each frame == 9
Total score == 10 frames x 9 == 90

5/|5/|5/|5/|5/|5/|5/|5/|5/|5/||5
Five pins on the first ball of all ten frames.
Second ball of each frame hits all five remaining
pins, a spare.
One bonus ball, hits five pins.
Score for each frame == 10 + score for next one
ball == 10 + 5 == 15
Total score == 10 frames x 15 == 150

X|7/|9-|X|-8|8/|-6|X|X|X||81
Total score == 167
```
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ ___
## SHM - zadanie grupowe

* Napisz testy do SHM (0 punktów)
* nie zgłaszajcie nam PR ;) możecie się pochwalić testami lub zapytać o nie na Discordzie.
* nie zgłaszajcie nam PR 😉 możecie się pochwalić testami lub zapytać o nie na Discordzie.

___

Expand Down
108 changes: 108 additions & 0 deletions module1/index.en.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">

<title>Testing - Coders School</title>

<meta name="description" content="Testing">
<meta name="author" content="Łukasz Ziobroń">

<link rel="stylesheet" href="../../css/reset.css">
<link rel="stylesheet" href="../../css/reveal.css">
<link rel="stylesheet" href="../../css/theme/coders.css" id="theme">

<!-- Theme used for syntax highlighting of code -->
<link rel="stylesheet" href="../../lib/css/monokai.css">

<!-- Printing and PDF exports -->
<script>
var link = document.createElement( 'link' );
link.rel = 'stylesheet';
link.type = 'text/css';
link.href = window.location.search.match( /print-pdf/gi ) ? '../../css/print/pdf.css' : '../../css/print/paper.css';
document.getElementsByTagName( 'head' )[0].appendChild( link );
</script>
</head>
<body>
<div class="reveal">
<div class="slides">
<section>
<section data-background="#111111">

<h1>Testing #1</h1>
<h2><code>catch2</code> framework</h2>

<a href="https://coders.school">
<img width="500" data-src="../coders_school_logo.png" alt="Coders School" class="plain">
</a>

<h3>Łukasz Ziobroń</h3>

</section>
<section data-markdown>
<textarea data-template>

## Agenda

1. <!-- .element: class="fragment fade-in" --> <code>catch2</code> framework

</textarea>
</section>
</section>
<!--
Note that Windows uses `\r\n` instead of `\n` as its linefeed character.
For a regex that supports all operating systems, use `\r?\n` instead of `\n`.

Usage:
Install dependencies

$ npm install
Serve the presentation and monitor source files for changes

$ npm start
Open http://localhost:8000 to view your presentation

You can change the port by using npm start -- --port=8001.
-->
<section data-markdown="00_catch.en.md"
data-separator-vertical="^___"
data-separator-notes="^Note:">
</section>
<section data-markdown="01_homework.en.md"
data-separator-vertical="^___"
data-separator-notes="^Note:">
</section>
<section data-background="#111111">

<h1>Coders School</h1>
<img width="400" data-src="../logo.png" alt="Coders School" class="plain">

</section>
</div>
</div>

<script src="../../js/reveal.js"></script>

<script>
// More info about config & dependencies:
// - https://github.com/hakimel/reveal.js#configuration
// - https://github.com/hakimel/reveal.js#dependencies
Reveal.initialize({
width: 1200,
height: 750,
slideNumber: true,
hash: true,
pdfSeparateFragments: false,
dependencies: [
{ src: '../../plugin/externalcode/externalcode.js', condition: function() { return !!document.querySelector( '[data-code]' ); } },
{ src: '../../plugin/highlight/highlight.js', async: true, callback: function() { hljs.initHighlightingOnLoad(); } },
{ src: '../../plugin/markdown/marked.js' },
{ src: '../../plugin/markdown/markdown.js' },
{ src: '../../plugin/notes/notes.js', async: true }
]
});
</script>
</body>
</html>
6 changes: 3 additions & 3 deletions module1/index.html → module1/index.pl.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">

<title>Testing - Coders School</title>
<title>Testowanie - Coders School</title>

<meta name="description" content="Testing">
<meta name="author" content="Łukasz Ziobroń">
Expand Down Expand Up @@ -66,11 +66,11 @@ <h3>Łukasz Ziobroń</h3>

You can change the port by using npm start -- --port=8001.
-->
<section data-markdown="presentation_catch.md"
<section data-markdown="00_catch.pl.md"
data-separator-vertical="^___"
data-separator-notes="^Note:">
</section>
<section data-markdown="presentation_homework.md"
<section data-markdown="01_homework.pl.md"
data-separator-vertical="^___"
data-separator-notes="^Note:">
</section>
Expand Down
Loading