2 %
\93\8c\8b\9e ReportLab Generated PDF document http://www.reportlab.com
5 /F1 2 0 R /F2 3 0 R /F3 4 0 R /F4 5 0 R /F5 6 0 R /F6 9 0 R
10 /BaseFont /Helvetica /Encoding /WinAnsiEncoding /Name /F1 /Subtype /Type1 /Type /Font
15 /BaseFont /Helvetica-Bold /Encoding /WinAnsiEncoding /Name /F2 /Subtype /Type1 /Type /Font
20 /BaseFont /Courier-Bold /Encoding /WinAnsiEncoding /Name /F3 /Subtype /Type1 /Type /Font
25 /BaseFont /Courier /Encoding /WinAnsiEncoding /Name /F4 /Subtype /Type1 /Type /Font
30 /BaseFont /Courier-Oblique /Encoding /WinAnsiEncoding /Name /F5 /Subtype /Type1 /Type /Font
35 /Contents 19 0 R /MediaBox [ 0 0 595.2756 841.8898 ] /Parent 18 0 R /Resources <<
36 /Font 1 0 R /ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ]
37 >> /Rotate 0 /Trans <<
46 /S /URI /Type /Action /URI (https://projecteuler.net/project/resources/p102_triangles.txt)
47 >> /Border [ 0 0 0 ] /Rect [ 62.69291 717.0236 209.4129 729.0236 ] /Subtype /Link /Type /Annot
52 /BaseFont /Helvetica-Oblique /Encoding /WinAnsiEncoding /Name /F6 /Subtype /Type1 /Type /Font
57 /Annots [ 8 0 R ] /Contents 20 0 R /MediaBox [ 0 0 595.2756 841.8898 ] /Parent 18 0 R /Resources <<
58 /Font 1 0 R /ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ]
67 /Outlines 13 0 R /PageLabels 21 0 R /PageMode /UseNone /Pages 18 0 R /Type /Catalog
72 /Author () /CreationDate (D:20190313201115+00'00') /Creator (\(unspecified\)) /Keywords () /ModDate (D:20190313201115+00'00') /Producer (ReportLab PDF Library - www.reportlab.com)
73 /Subject (\(unspecified\)) /Title (Unit testing) /Trapped /False
78 /Count 4 /First 14 0 R /Last 17 0 R /Type /Outlines
83 /Dest [ 7 0 R /XYZ 62.69291 439.8236 0 ] /Next 15 0 R /Parent 13 0 R /Title (Why)
88 /Dest [ 7 0 R /XYZ 62.69291 292.8236 0 ] /Next 16 0 R /Parent 13 0 R /Prev 14 0 R /Title (How)
93 /Dest [ 7 0 R /XYZ 62.69291 187.8236 0 ] /Next 17 0 R /Parent 13 0 R /Prev 15 0 R /Title (What)
98 /Dest [ 10 0 R /XYZ 62.69291 705.0236 0 ] /Parent 13 0 R /Prev 16 0 R /Title (Test driven development)
103 /Count 2 /Kids [ 7 0 R 10 0 R ] /Type /Pages
111 1 0 0 1 0 0 cm BT /F1 12 Tf 14.4 TL ET
113 1 0 0 1 62.69291 741.0236 cm
115 BT 1 0 0 1 0 4 Tm 179.9449 0 Td 24 TL /F2 20 Tf 0 0 0 rg (Unit testing) Tj T* -179.9449 0 Td ET
119 1 0 0 1 62.69291 695.0236 cm
121 BT 1 0 0 1 0 26 Tm 3.17248 Tw 12 TL /F1 10 Tf 0 0 0 rg (Unit testing means testing small portions \(individual functions, modules, classes\) of your program,) Tj T* 0 Tw .411654 Tw (independently of the rest, in an automated fashion. The tests usually consist of a set of functions that are) Tj T* 0 Tw (distributed along with the rest of the source code.) Tj T* ET
125 1 0 0 1 62.69291 641.0236 cm
128 BT 1 0 0 1 0 38 Tm /F1 10 Tf 12 TL 2.051654 Tw (Each test will call part of the main source code, usually with some dummy data, and verify that the) Tj T* 0 Tw -0.101512 Tw (behaviour of the code is as expected. It is typical to test a few edge cases and boundary conditions in such) Tj T* 0 Tw .848735 Tw (a way. A primitive attempt to test a python function, that implements a mathematical function might look) Tj T* 0 Tw (like this:) Tj T* ET
132 1 0 0 1 62.69291 451.8236 cm
139 .662745 .662745 .662745 RG
141 .960784 .960784 .862745 rg
142 n -6 -6 468.6898 180 re B*
145 .960784 .960784 .862745 rg
147 .960784 .960784 .862745 rg
149 .960784 .960784 .862745 rg
151 .960784 .960784 .862745 rg
153 .960784 .960784 .862745 rg
154 n 108 156 12 12 re f*
155 .960784 .960784 .862745 rg
156 n 18 144 432 12 re f*
157 .960784 .960784 .862745 rg
159 .960784 .960784 .862745 rg
161 .960784 .960784 .862745 rg
163 .960784 .960784 .862745 rg
165 .960784 .960784 .862745 rg
166 n 120 120 12 12 re f*
167 .960784 .960784 .862745 rg
169 .960784 .960784 .862745 rg
170 n 138 120 18 12 re f*
171 .960784 .960784 .862745 rg
173 .960784 .960784 .862745 rg
175 .960784 .960784 .862745 rg
177 .960784 .960784 .862745 rg
179 .960784 .960784 .862745 rg
181 .960784 .960784 .862745 rg
183 .960784 .960784 .862745 rg
184 n 102 108 12 12 re f*
185 .960784 .960784 .862745 rg
187 .960784 .960784 .862745 rg
188 n 120 108 18 12 re f*
189 .960784 .960784 .862745 rg
190 n 138 108 12 12 re f*
191 .960784 .960784 .862745 rg
193 .960784 .960784 .862745 rg
195 .960784 .960784 .862745 rg
197 .960784 .960784 .862745 rg
199 .960784 .960784 .862745 rg
201 .960784 .960784 .862745 rg
203 .960784 .960784 .862745 rg
205 .960784 .960784 .862745 rg
207 .960784 .960784 .862745 rg
209 .960784 .960784 .862745 rg
211 .960784 .960784 .862745 rg
213 .960784 .960784 .862745 rg
215 .960784 .960784 .862745 rg
217 .960784 .960784 .862745 rg
219 .960784 .960784 .862745 rg
221 .960784 .960784 .862745 rg
223 .960784 .960784 .862745 rg
225 .960784 .960784 .862745 rg
227 .960784 .960784 .862745 rg
229 .960784 .960784 .862745 rg
231 .960784 .960784 .862745 rg
233 .960784 .960784 .862745 rg
235 .960784 .960784 .862745 rg
237 .960784 .960784 .862745 rg
239 .960784 .960784 .862745 rg
241 .960784 .960784 .862745 rg
243 .960784 .960784 .862745 rg
245 .960784 .960784 .862745 rg
247 .960784 .960784 .862745 rg
249 .960784 .960784 .862745 rg
251 .960784 .960784 .862745 rg
253 .960784 .960784 .862745 rg
255 .960784 .960784 .862745 rg
257 .960784 .960784 .862745 rg
259 .960784 .960784 .862745 rg
261 .960784 .960784 .862745 rg
263 .960784 .960784 .862745 rg
265 .960784 .960784 .862745 rg
267 BT 1 0 0 1 0 158 Tm 12 TL /F3 10 Tf 0 .501961 0 rg (def) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (calc_deg_sin) Tj 0 0 0 rg (\() Tj 0 0 0 rg (x) Tj 0 0 0 rg (\):) Tj 0 0 0 rg T* ( ) Tj /F5 10 Tf .729412 .129412 .129412 rg ("""This is an elaborate python function that calculates the mathematical) Tj T* ( function f\(x\)=sin\(x\), where x is in degrees. """) Tj /F4 10 Tf 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (from) Tj /F4 10 Tf 0 0 0 rg ( ) Tj /F3 10 Tf 0 0 1 rg (math) Tj /F4 10 Tf 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (import) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (pi) Tj 0 0 0 rg (,) Tj 0 0 0 rg (sin) Tj 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (return) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (sin) Tj 0 0 0 rg (\() Tj 0 0 0 rg (x) Tj .4 .4 .4 rg (*) Tj 0 0 0 rg (\() Tj 0 0 0 rg (pi) Tj .4 .4 .4 rg (/) Tj .4 .4 .4 rg (189) Tj 0 0 0 rg (\)\)) Tj 0 0 0 rg T* T* /F3 10 Tf 0 .501961 0 rg (def) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (test_sin_90_is_1) Tj 0 0 0 rg (\(\):) Tj 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (assert) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (calc_deg_sin) Tj 0 0 0 rg (\() Tj .4 .4 .4 rg (90) Tj 0 0 0 rg (\)) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (==) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (1) Tj 0 0 0 rg T* T* /F3 10 Tf 0 .501961 0 rg (def) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (test_sin_0_is_0) Tj 0 0 0 rg (\(\):) Tj 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (assert) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (calc_deg_sin) Tj 0 0 0 rg (\() Tj .4 .4 .4 rg (0) Tj 0 0 0 rg (\)) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (==) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (0) Tj 0 0 0 rg T* T* /F3 10 Tf 0 .501961 0 rg (def) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (test_sin_180_and_360_is_0) Tj 0 0 0 rg (\(\):) Tj 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (assert) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (calc_deg_sin) Tj 0 0 0 rg (\() Tj .4 .4 .4 rg (180) Tj 0 0 0 rg (\)) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (==) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (0) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (&) Tj (&) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (calc_deg_sin) Tj 0 0 0 rg (\() Tj .4 .4 .4 rg (360) Tj 0 0 0 rg (\)) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (==) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (0) Tj T* ET
274 1 0 0 1 62.69291 418.8236 cm
276 BT 1 0 0 1 0 3.5 Tm 21 TL /F2 17.5 Tf 0 0 0 rg (Why) Tj T* ET
280 1 0 0 1 62.69291 400.8236 cm
283 BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL (Unit testing is a useful thing to do for a number of reasons, including \(in no particular order\):) Tj T* ET
287 1 0 0 1 62.69291 394.8236 cm
290 1 0 0 1 62.69291 394.8236 cm
293 1 0 0 1 62.69291 382.8236 cm
295 BT /F1 10 Tf 12 TL ET
300 BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL 10.5 0 Td (\177) Tj T* -10.5 0 Td ET
307 BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL (Unit tests document the expected behaviour of your program.) Tj T* ET
314 1 0 0 1 62.69291 376.8236 cm
317 1 0 0 1 62.69291 352.8236 cm
319 BT /F1 10 Tf 12 TL ET
324 BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL 10.5 0 Td (\177) Tj T* -10.5 0 Td ET
331 BT 1 0 0 1 0 14 Tm /F1 10 Tf 12 TL 1.40528 Tw (Unit tests allow you to verify that you did not make unintended changes to the behaviour of your) Tj T* 0 Tw (program when you add features, or change the implementation.) Tj T* ET
338 1 0 0 1 62.69291 346.8236 cm
341 1 0 0 1 62.69291 322.8236 cm
343 BT /F1 10 Tf 12 TL ET
348 BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL 10.5 0 Td (\177) Tj T* -10.5 0 Td ET
355 BT 1 0 0 1 0 14 Tm /F1 10 Tf 12 TL .753516 Tw (Unit tests catch many bugs before your program runs for real \(before you submit the job that takes) Tj T* 0 Tw (multiple days, but crashes right before it prints out the result\).) Tj T* ET
362 1 0 0 1 62.69291 316.8236 cm
365 1 0 0 1 62.69291 304.8236 cm
367 BT /F1 10 Tf 12 TL ET
372 BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL 10.5 0 Td (\177) Tj T* -10.5 0 Td ET
379 BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL (Unit tests allow you to conveniently play with unfamiliar libraries/apis/modules language features.) Tj T* ET
386 1 0 0 1 62.69291 304.8236 cm
389 1 0 0 1 62.69291 271.8236 cm
391 BT 1 0 0 1 0 3.5 Tm 21 TL /F2 17.5 Tf 0 0 0 rg (How) Tj T* ET
395 1 0 0 1 62.69291 229.8236 cm
398 BT 1 0 0 1 0 26 Tm /F1 10 Tf 12 TL -0.135662 Tw (Use a test runner. A test runner will find all functions in a file or module that are defined to be tests, and run) Tj T* 0 Tw .754431 Tw (them. It will also give you a convenient output of the result, and some basic statistics. Test runners vary) Tj T* 0 Tw (greatly in their ease of use, flexibility and the usefulness of their output.) Tj T* ET
402 1 0 0 1 62.69291 199.8236 cm
404 BT 1 0 0 1 0 14 Tm .386488 Tw 12 TL /F1 10 Tf 0 0 0 rg (In this case I am using ) Tj /F4 10 Tf 0 0 0 rg (pytest) Tj /F1 10 Tf 0 0 0 rg (. ) Tj /F4 10 Tf 0 0 0 rg (pytest) Tj /F1 10 Tf 0 0 0 rg ( will execute all top level functions in a file that start with ) Tj /F4 10 Tf 0 0 0 rg (test_) Tj /F1 10 Tf 0 0 0 rg (.) Tj T* 0 Tw (You run the tests in a file with ) Tj /F4 10 Tf 0 0 0 rg (pytest) Tj ( ) Tj (FILE) Tj ( ) Tj ([FILE]) Tj ( ) Tj ([FILE]...) Tj /F1 10 Tf 0 0 0 rg (.) Tj T* ET
408 1 0 0 1 62.69291 166.8236 cm
410 BT 1 0 0 1 0 3.5 Tm 21 TL /F2 17.5 Tf 0 0 0 rg (What) Tj T* ET
414 1 0 0 1 62.69291 148.8236 cm
416 BT 1 0 0 1 0 2 Tm 12 TL /F1 10 Tf 0 0 0 rg (Look at the examples in this directory. The files staring with ) Tj /F4 10 Tf 0 0 0 rg (<) Tj (somenumber) Tj (>) Tj (_) Tj /F1 10 Tf 0 0 0 rg ( contain tests.) Tj T* ET
420 1 0 0 1 62.69291 130.8236 cm
423 BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL (The first file contains some basic tests. Some will fail, some will pass.) Tj T* ET
427 1 0 0 1 62.69291 88.82362 cm
429 BT 1 0 0 1 0 26 Tm 1.282126 Tw 12 TL /F1 10 Tf 0 0 0 rg (The second file contains tests that check if a function called ) Tj /F4 10 Tf 0 0 0 rg (incorrect_ackermann) Tj /F1 10 Tf 0 0 0 rg ( will produce the) Tj T* 0 Tw 2.160542 Tw (expected values for a number of different inputs \(hint: it won't\). Fix any problems that turn up \( the) Tj T* 0 Tw (definition of the ackermann function is at the very bottom of the file that implements it\).) Tj T* ET
440 1 0 0 1 0 0 cm BT /F1 12 Tf 14.4 TL ET
442 1 0 0 1 62.69291 717.0236 cm
444 BT 1 0 0 1 0 38 Tm .472126 Tw 12 TL /F1 10 Tf 0 0 0 rg (The third file contains tests for two functions, ) Tj /F4 10 Tf 0 0 0 rg (collatz) Tj /F1 10 Tf 0 0 0 rg ( and ) Tj /F4 10 Tf 0 0 0 rg (longest_collatz) Tj /F1 10 Tf 0 0 0 rg (. These return the length) Tj T* 0 Tw .959986 Tw (of the collatz sequence for a particular integer, and the integer with the longest collatz sequence that is) Tj T* 0 Tw .25832 Tw (smaller than the input integer. Implement these functions so that they pass the tests. This is based on the) Tj T* 0 Tw 0 0 .501961 rg (Euler Project problem number 14) Tj T* ET
448 1 0 0 1 62.69291 684.0236 cm
450 BT 1 0 0 1 0 3.5 Tm 21 TL /F2 17.5 Tf 0 0 0 rg (Test driven development) Tj T* ET
454 1 0 0 1 62.69291 630.0236 cm
457 BT 1 0 0 1 0 38 Tm /F1 10 Tf 12 TL 1.961235 Tw (Test driven development is a practice, whereby one first writes the tests that fully describe a certain) Tj T* 0 Tw 1.87881 Tw (feature \(or test for a particular bug\). These tests should all initially fail. Then one writes the simplest) Tj T* 0 Tw .537045 Tw (implementation that will make these tests pass. Doing things in this order forces one to be very thorough) Tj T* 0 Tw (with writing tests. It is a lot of work however.) Tj T* ET
461 1 0 0 1 62.69291 588.0236 cm
463 BT 1 0 0 1 0 26 Tm .04881 Tw 12 TL /F1 10 Tf 0 0 0 rg (Pick your favourite algorithm \(ideally one ) Tj /F6 10 Tf (you) Tj /F1 10 Tf ( can implement in python\). Write some tests for a function \(or) Tj T* 0 Tw 1.864983 Tw (functions\) that implements that algorithm, then implement that algorithm to pass the tests that you've) Tj T* 0 Tw (written.) Tj T* ET
467 1 0 0 1 62.69291 570.0236 cm
470 BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL (Some good algorithms to tests with might be:) Tj T* ET
474 1 0 0 1 62.69291 564.0236 cm
477 1 0 0 1 62.69291 564.0236 cm
480 1 0 0 1 62.69291 552.0236 cm
482 BT /F1 10 Tf 12 TL ET
487 BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL 10.5 0 Td (\177) Tj T* -10.5 0 Td ET
494 BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL (Binary search) Tj T* ET
501 1 0 0 1 62.69291 546.0236 cm
504 1 0 0 1 62.69291 534.0236 cm
506 BT /F1 10 Tf 12 TL ET
511 BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL 10.5 0 Td (\177) Tj T* -10.5 0 Td ET
518 BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL (Your favourite sorting algorithm) Tj T* ET
525 1 0 0 1 62.69291 528.0236 cm
528 1 0 0 1 62.69291 516.0236 cm
530 BT /F1 10 Tf 12 TL ET
535 BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL 10.5 0 Td (\177) Tj T* -10.5 0 Td ET
542 BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL (DFS/BFS) Tj T* ET
549 1 0 0 1 62.69291 510.0236 cm
552 1 0 0 1 62.69291 498.0236 cm
554 BT /F1 10 Tf 12 TL ET
559 BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL 10.5 0 Td (\177) Tj T* -10.5 0 Td ET
566 BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL (Calculating the edit distance between two strings) Tj T* ET
573 1 0 0 1 62.69291 492.0236 cm
576 1 0 0 1 62.69291 480.0236 cm
578 BT /F1 10 Tf 12 TL ET
583 BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL 10.5 0 Td (\177) Tj T* -10.5 0 Td ET
590 BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL (Kernel convolution) Tj T* ET
597 1 0 0 1 62.69291 474.0236 cm
600 1 0 0 1 62.69291 462.0236 cm
602 BT /F1 10 Tf 12 TL ET
607 BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL 10.5 0 Td (\177) Tj T* -10.5 0 Td ET
614 BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL (Maximum parsimony) Tj T* ET
621 1 0 0 1 62.69291 456.0236 cm
624 1 0 0 1 62.69291 444.0236 cm
626 BT /F1 10 Tf 12 TL ET
631 BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL 10.5 0 Td (\177) Tj T* -10.5 0 Td ET
638 BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL (Calculate the Levenshtein or edit distance between two strings) Tj T* ET
645 1 0 0 1 62.69291 438.0236 cm
648 1 0 0 1 62.69291 414.0236 cm
650 BT /F1 10 Tf 12 TL ET
655 BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL 10.5 0 Td (\177) Tj T* -10.5 0 Td ET
662 BT 1 0 0 1 0 14 Tm /F1 10 Tf 12 TL 1.266098 Tw (Calculating the value of the fibonacci sequence, the sum of integers up to n, the first n primes or) Tj T* 0 Tw (some other such mathematical function) Tj T* ET
669 1 0 0 1 62.69291 414.0236 cm
676 /Nums [ 0 22 0 R 1 23 0 R ]
718 [<0e78adeec461ba0fa6ed6f6f883a9461><0e78adeec461ba0fa6ed6f6f883a9461>]
719 % ReportLab generated PDF document -- digest (http://www.reportlab.com)