{ "cells": [ { "cell_type": "markdown", "metadata": { "button": false, "new_sheet": false, "run_control": { "read_only": false }, "slideshow": { "slide_type": "slide" } }, "source": [ "# Title\n", "\n", "_Brief abstract/introduction/motivation. State what the chapter is about in 1-2 paragraphs._\n", "_Then, have an introduction video:_" ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "execution": { "iopub.execute_input": "2024-01-17T21:55:04.316992Z", "iopub.status.busy": "2024-01-17T21:55:04.316880Z", "iopub.status.idle": "2024-01-17T21:55:04.348419Z", "shell.execute_reply": "2024-01-17T21:55:04.348131Z" }, "slideshow": { "slide_type": "skip" } }, "outputs": [ { "data": { "text/html": [ "\n", " \n", " " ], "text/plain": [ "" ] }, "execution_count": 1, "metadata": {}, "output_type": "execute_result" } ], "source": [ "from bookutils import YouTubeVideo\n", "YouTubeVideo(\"w4u5gCgPlmg\")" ] }, { "cell_type": "markdown", "metadata": { "button": false, "new_sheet": false, "run_control": { "read_only": false }, "slideshow": { "slide_type": "subslide" } }, "source": [ "**Prerequisites**\n", "\n", "* _Refer to earlier chapters as notebooks here, as here:_ [Earlier Chapter](Debugger.ipynb)." ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "button": false, "execution": { "iopub.execute_input": "2024-01-17T21:55:04.368774Z", "iopub.status.busy": "2024-01-17T21:55:04.368594Z", "iopub.status.idle": "2024-01-17T21:55:04.370856Z", "shell.execute_reply": "2024-01-17T21:55:04.370603Z" }, "new_sheet": false, "run_control": { "read_only": false }, "slideshow": { "slide_type": "skip" } }, "outputs": [], "source": [ "import bookutils.setup" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "## Synopsis\n", "\n", "\n", "To [use the code provided in this chapter](Importing.ipynb), write\n", "\n", "```python\n", ">>> from debuggingbook.Template import \n", "```\n", "\n", "and then make use of the following features.\n", "\n", "\n", "_For those only interested in using the code in this chapter (without wanting to know how it works), give an example. This will be copied to the beginning of the chapter (before the first section) as text with rendered input and output._\n", "\n", "You can use `int_fuzzer()` as:\n", "\n", "```python\n", ">>> print(int_fuzzer())\n", "76.5\n", "\n", "```\n" ] }, { "cell_type": "markdown", "metadata": { "button": false, "new_sheet": true, "run_control": { "read_only": false }, "slideshow": { "slide_type": "slide" } }, "source": [ "## _Section 1_\n", "\n", "\\todo{Add}" ] }, { "cell_type": "markdown", "metadata": { "button": false, "new_sheet": false, "run_control": { "read_only": false }, "slideshow": { "slide_type": "slide" } }, "source": [ "## _Section 2_\n", "\n", "\\todo{Add}" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "### Excursion: All the Details" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "fragment" } }, "source": [ "This text will only show up on demand (HTML) or not at all (PDF). This is useful for longer implementations, or repetitive, or specialized parts." ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "### End of Excursion" ] }, { "cell_type": "markdown", "metadata": { "button": false, "new_sheet": false, "run_control": { "read_only": false }, "slideshow": { "slide_type": "subslide" } }, "source": [ "## _Section 3_\n", "\n", "\\todo{Add}\n", "\n", "_If you want to introduce code, it is helpful to state the most important functions, as in:_\n", "\n", "* `random.randrange(start, end)` - return a random number [`start`, `end`]\n", "* `range(start, end)` - create a list with integers from `start` to `end`. Typically used in iterations.\n", "* `for elem in list: body` executes `body` in a loop with `elem` taking each value from `list`.\n", "* `for i in range(start, end): body` executes `body` in a loop with `i` from `start` to `end` - 1.\n", "* `chr(n)` - return a character with ASCII code `n`" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "execution": { "iopub.execute_input": "2024-01-17T21:55:04.372686Z", "iopub.status.busy": "2024-01-17T21:55:04.372579Z", "iopub.status.idle": "2024-01-17T21:55:04.374183Z", "shell.execute_reply": "2024-01-17T21:55:04.373924Z" }, "slideshow": { "slide_type": "skip" } }, "outputs": [], "source": [ "import random" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "execution": { "iopub.execute_input": "2024-01-17T21:55:04.375703Z", "iopub.status.busy": "2024-01-17T21:55:04.375601Z", "iopub.status.idle": "2024-01-17T21:55:04.377536Z", "shell.execute_reply": "2024-01-17T21:55:04.377294Z" }, "slideshow": { "slide_type": "subslide" } }, "outputs": [], "source": [ "def int_fuzzer() -> float:\n", " \"\"\"A simple function that returns a random float\"\"\"\n", " return random.randrange(1, 100) + 0.5" ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "button": false, "code_folding": [], "execution": { "iopub.execute_input": "2024-01-17T21:55:04.379059Z", "iopub.status.busy": "2024-01-17T21:55:04.378952Z", "iopub.status.idle": "2024-01-17T21:55:04.380521Z", "shell.execute_reply": "2024-01-17T21:55:04.380283Z" }, "new_sheet": false, "run_control": { "read_only": false }, "slideshow": { "slide_type": "subslide" } }, "outputs": [], "source": [ "# More code\n", "pass" ] }, { "cell_type": "markdown", "metadata": { "button": false, "new_sheet": false, "run_control": { "read_only": false }, "slideshow": { "slide_type": "slide" } }, "source": [ "## _Section 4_\n", "\n", "\\todo{Add}" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "## Synopsis" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "fragment" } }, "source": [ "_For those only interested in using the code in this chapter (without wanting to know how it works), give an example. This will be copied to the beginning of the chapter (before the first section) as text with rendered input and output._" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "fragment" } }, "source": [ "You can use `int_fuzzer()` as:" ] }, { "cell_type": "code", "execution_count": 6, "metadata": { "execution": { "iopub.execute_input": "2024-01-17T21:55:04.382005Z", "iopub.status.busy": "2024-01-17T21:55:04.381924Z", "iopub.status.idle": "2024-01-17T21:55:04.383805Z", "shell.execute_reply": "2024-01-17T21:55:04.383553Z" }, "slideshow": { "slide_type": "fragment" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "76.5\n" ] } ], "source": [ "print(int_fuzzer())" ] }, { "cell_type": "markdown", "metadata": { "button": false, "new_sheet": true, "run_control": { "read_only": false }, "slideshow": { "slide_type": "slide" } }, "source": [ "## Lessons Learned\n", "\n", "* _Lesson one_\n", "* _Lesson two_\n", "* _Lesson three_" ] }, { "cell_type": "markdown", "metadata": { "button": false, "new_sheet": false, "run_control": { "read_only": false }, "slideshow": { "slide_type": "slide" } }, "source": [ "## Next Steps\n", "\n", "_Link to subsequent chapters (notebooks) here, as in:_\n", "\n", "* [use _assertions_ to check conditions at runtime](Assertions.ipynb)\n", "* [reduce _failing inputs_ for efficient debugging](DeltaDebugger.ipynb)\n" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "## Background\n", "\n", "_Cite relevant works in the literature and put them into context, as in:_\n", "\n", "The idea of ensuring that each expansion in the grammar is used at least once goes back to Burkhardt \\cite{Burkhardt1967}, to be later rediscovered by Paul Purdom \\cite{Purdom1972}." ] }, { "cell_type": "markdown", "metadata": { "button": false, "new_sheet": true, "run_control": { "read_only": false }, "slideshow": { "slide_type": "slide" } }, "source": [ "## Exercises\n", "\n", "_Close the chapter with a few exercises such that people have things to do. To make the solutions hidden (to be revealed by the user), have them start with_\n", "\n", "```\n", "**Solution.**\n", "```\n", "\n", "_Your solution can then extend up to the next title (i.e., any markdown cell starting with `#`)._\n", "\n", "_Running `make metadata` will automatically add metadata to the cells such that the cells will be hidden by default, and can be uncovered by the user. The button will be introduced above the solution._" ] }, { "cell_type": "markdown", "metadata": { "button": false, "new_sheet": false, "run_control": { "read_only": false }, "slideshow": { "slide_type": "subslide" } }, "source": [ "### Exercise 1: _Title_\n", "\n", "_Text of the exercise_" ] }, { "cell_type": "code", "execution_count": 7, "metadata": { "cell_style": "center", "execution": { "iopub.execute_input": "2024-01-17T21:55:04.385519Z", "iopub.status.busy": "2024-01-17T21:55:04.385424Z", "iopub.status.idle": "2024-01-17T21:55:04.386982Z", "shell.execute_reply": "2024-01-17T21:55:04.386745Z" }, "slideshow": { "slide_type": "fragment" } }, "outputs": [], "source": [ "# Some code that is part of the exercise\n", "pass" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "fragment" }, "solution2": "hidden", "solution2_first": true }, "source": [ "_Some more text for the exercise_" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "skip" }, "solution2": "hidden" }, "source": [ "**Solution.** _Some text for the solution_" ] }, { "cell_type": "code", "execution_count": 8, "metadata": { "cell_style": "split", "execution": { "iopub.execute_input": "2024-01-17T21:55:04.388646Z", "iopub.status.busy": "2024-01-17T21:55:04.388540Z", "iopub.status.idle": "2024-01-17T21:55:04.390564Z", "shell.execute_reply": "2024-01-17T21:55:04.390335Z" }, "slideshow": { "slide_type": "skip" }, "solution2": "hidden" }, "outputs": [ { "data": { "text/plain": [ "4" ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Some code for the solution\n", "2 + 2" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "skip" }, "solution2": "hidden" }, "source": [ "_Some more text for the solution_" ] }, { "cell_type": "markdown", "metadata": { "button": false, "new_sheet": false, "run_control": { "read_only": false }, "slideshow": { "slide_type": "subslide" }, "solution": "hidden", "solution2": "hidden", "solution2_first": true, "solution_first": true }, "source": [ "### Exercise 2: _Title_\n", "\n", "_Text of the exercise_" ] }, { "cell_type": "markdown", "metadata": { "button": false, "new_sheet": false, "run_control": { "read_only": false }, "slideshow": { "slide_type": "skip" }, "solution": "hidden", "solution2": "hidden" }, "source": [ "**Solution.** _Solution for the exercise_" ] } ], "metadata": { "ipub": { "bibliography": "fuzzingbook.bib", "toc": true }, "kernelspec": { "display_name": "venv", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.10.2" }, "toc": { "base_numbering": 1, "nav_menu": {}, "number_sections": true, "sideBar": true, "skip_h1_title": true, "title_cell": "", "title_sidebar": "Contents", "toc_cell": false, "toc_position": {}, "toc_section_display": true, "toc_window_display": true }, "toc-autonumbering": false, "vscode": { "interpreter": { "hash": "0af4f07dd039d1b4e562c7a7d0340393b1c66f50605ac6af30beb81aa23b7ef5" } } }, "nbformat": 4, "nbformat_minor": 4 }