Sfoglia il codice sorgente

Minor formatting to instructions

parent
commit
9f058ca1eb
1 ha cambiato i file con 39 aggiunte e 66 eliminazioni
  1. 39
    66
      labTesting.md

+ 39
- 66
labTesting.md Vedi File

@@ -9,22 +9,16 @@ Throughout this exercise the students will practice:
9 9
 
10 10
 ## Concepts
11 11
 
12
-As you have learned in previous labs, getting a program to compile is only a minor part of programming. It is super
13
-important to test functions in order to validate that they produce the correct results.
12
+As you have learned in previous labs, getting a program to compile is only a minor part of programming. It is super important to test functions in order to validate that they produce the correct results.
14 13
 
15 14
 
16 15
 ### Exercise 1
17 16
 
18
-This exercise is an adaptation of [1]. You are provided with a program that implements several versions of five simple
19
-functions, e.g. rock-paper-scisors, sorting 3 numbers. By testing the versions, you and your partner will determine
20
-which of the versions is correctly implemented.   
17
+This exercise is an adaptation of [1]. You are provided with a program that implements several versions of five simple functions, e.g. rock-paper-scisors, sorting 3 numbers. By testing the versions, you and your partner will determine which of the versions is correctly implemented.   
21 18
 
22
-This first exercise requires **NO programming**, just testing.  For this first exercise, you **do not** have to
23
-implement any unit tests.  Just use you testing ability (*by hand*) to determine which function version is the one that
24
-is correctly implemented.  
19
+This first exercise requires **NO programming**, just testing.  For this first exercise, you **do not** have to implement any unit tests.  Just use you testing ability (*by hand*) to determine which function version is the one that is correctly implemented.  
25 20
 
26
-For instance, let us assume that a friend provides you with a program. He claims that his program solves the following
27
-problem:
21
+For instance, let us assume that a friend provides you with a program. He claims that his program solves the following problem:
28 22
 
29 23
 > *"given three different integers, displays the maximum value"*.  
30 24
 
@@ -32,96 +26,75 @@ Let's say that the program has an interfaces as follows:
32 26
 
33 27
 ![](http://i.imgur.com/BD6SmKh.png)
34 28
 
35
-**Without analysing the source code**, you could determine if the program provides valid results.  You could try the
36
-following cases:
29
+**Without analysing the source code**, you could determine if the program provides valid results.  You could try the following cases:
37 30
 
38 31
 * a = 4, b = 2, c = 1, expect result: 4
39 32
 * a = 3, b = 6, c = 2, expected result: 6
40 33
 * a = 1, b = 10, c = 100, expected result: 100
41 34
 
42
-If any of the three cases fails to give the expected result, you friend's program is not working. On the other hand, If
43
-all three cases are successful, then the program has a high probability of being correct.
35
+If any of the three cases fails to give the expected result, you friend's program is not working. On the other hand, If all three cases are successful, then the program has a high probability of being correct.
44 36
 
45 37
 In this exercise, you will be validating various versions of the following functions:
46 38
 
47
-* **3 Sorts**: a program that receives three strings and sorts them in lexicographical order. For example, given
48
-`jirafa`, `zorra`, and `coqui`. Will sort them as: `coqui`, `jirafa`, and `zorra`.
39
+* **3 Sorts**: a program that receives three strings and sorts them in lexicographical order. For example, given `jirafa`, `zorra`, and `coqui`. Will sort them as: `coqui`, `jirafa`, and `zorra`.
49 40
 
50
-* **Dice**: when the user presses the `Roll them` button, the program will generate two random numbers between 1 and 6.
51
-The sum of the random numbers is reported. 
41
+* **Dice**: when the user presses the `Roll them` button, the program will generate two random numbers between 1 and 6.  The sum of the random numbers is reported. 
52 42
 
53
-* **Rock, Papers, Scissors**: The user enters the play for the two players ( 'R' for Rock, 'P' for Paper and 'S' for
54
-Scissors) and specifies the number of games needed to win the tournament. The program then reports who won and the
55
-score. The program reports if a player wins the tournament.
43
+* **Rock, Papers, Scissors**: The user enters the play for the two players ( 'R' for Rock, 'P' for Paper and 'S' for Scissors) and specifies the number of games needed to win the tournament. The program then reports who won and the score. The program reports if a player wins the tournament.
56 44
 
57
-* **Check Writer**: The user enters a number between 0 and 999,999,999 (inclusive). The program's output is a long
58
-string version of the number. For example, if the user inputs '654123' the program will output 'six hundred fifty four
59
-thousand one hundred twenty three'.
45
+* **Check Writer**: The user enters a number between 0 and 999,999,999 (inclusive). The program's output is a long string version of the number. For example, if the user inputs '654123' the program will output 'six hundred fifty four thousand one hundred twenty three'.
60 46
 
61
-* **Zulu time**: given the time in zulu time (Greenwich Mean Time) and the military zone that the user whishes to know,
62
-the program outputs the time at that zone. The format for the input is `####` in 23 hour format, e.g. 2212. The list of
63
-valid military zones is given in http://en.wikipedia.org/wiki/List_of_military_time_zones. Examples of correct output:
47
+* **Zulu time**: given the time in zulu time (Greenwich Mean Time) and the military zone that the user whishes to know, the program outputs the time at that zone. The format for the input is `####` in 23 hour format, e.g. 2212. The list of valid military zones is given in http://en.wikipedia.org/wiki/List_of_military_time_zones. Examples of correct output:
64 48
     * Given 1230 and zone A, the output would be 1330
65
-        * Given 1230 and zone N, the output would be 1130
49
+    * Given 1230 and zone N, the output would be 1130
66 50
 
67 51
 
68
-        Step 1: 
69
-        For each of the functions described above, write down in your notebook the tests that you will perform in order
70
-        to determine validity. 
52
+Step 1: 
53
+For each of the functions described above, write down in your notebook the tests that you will perform in order to determine validity. 
71 54
 
72
-        Step 2: 
73
-        Download the program from $XYZ$.
55
+Step 2: 
56
+Download the program from $XYZ$.
74 57
 
75
-        Step 3:
76
-        Run the program. You will see a window similar to the following:
58
+Step 3:
59
+Run the program. You will see a window similar to the following:
77 60
 
78
-        ![](http://demo05.cloudimage.io/s/resize/300/i.imgur.com/Uxnb8jP.png)
61
+![](http://demo05.cloudimage.io/s/resize/300/i.imgur.com/Uxnb8jP.png)
79 62
 
80
-        Click the **3 Sorts** button and you will get the following:
63
+Click the **3 Sorts** button and you will get the following:
81 64
 
82
-        ![](http://demo05.cloudimage.io/s/resize/300/i.imgur.com/p1NLIdM.png)
65
+![](http://demo05.cloudimage.io/s/resize/300/i.imgur.com/p1NLIdM.png)
83 66
 
84
-        The "Version Alpha" combo box indicates that you are running the first version of the 3 Sorts algorithm. Use the
85
-        tests that you wrote in step 1 to validate "Version Alpha". Then, do the same for versions beta, gamma and
86
-        delta.  Report which is the correct version in every method. Also, explain the tests that you performed that
87
-        allowed you to determine that the other versions are incorrect. 
67
+The "Version Alpha" combo box indicates that you are running the first version of the 3 Sorts algorithm. Use the tests that you wrote in step 1 to validate "Version Alpha". Then, do the same for versions beta, gamma and delta.  Report which is the correct version in every method. Also, explain the tests that you performed that allowed you to determine that the other versions are incorrect. 
88 68
 
89
-        For example, you could organice your results into a table. 
69
+For example, you could organice your results into a table. 
90 70
 
91
-        | Num | Test | Alpha | Beta | Gamma | Delta | 
92
-        | ------------- | ----------- | ----------- | ----------- | ----------- | ----------- |
93
-        | 1| "alce", "coyote", "zorro" | "alce", "coyote", "zorro" | .... | .... |
94
-        | 2| "alce", "zorro", "coyote" | "zorro", "alce", "coyote" | .... | .... |
71
+| Num | Test | Alpha | Beta | Gamma | Delta | 
72
+| ------------- | ----------- | ----------- | ----------- | ----------- | ----------- |
73
+| 1| "alce", "coyote", "zorro" | "alce", "coyote", "zorro" | .... | .... |
74
+| 2| "alce", "zorro", "coyote" | "zorro", "alce", "coyote" | .... | .... |
95 75
 
96 76
 ### Exercise 2
97 77
 
98
-Running tests "by hand" each time that you run a program gets tiresome very quickly. You and your partner have done it
99
-for a few simple functions. Imagine doing the same for full-blown program!, such as a browser or word processor.
78
+Running tests "by hand" each time that you run a program gets tiresome very quickly. You and your partner have done it for a few simple functions. Imagine doing the same for full-blown program!, such as a browser or word processor.
100 79
 
101
-    *Unit tests* help programmers produce valid code and ease the process of debugging while avoiding the tedious task
102
-    of entering tests by hand on each execution.
80
+*Unit tests* help programmers produce valid code and ease the process of debugging while avoiding the tedious task of entering tests by hand on each execution.
103 81
 
104 82
 
105
-    Step 1: 
106
-    Download the proyect from $XYZ$. The proyect contains only one source code file `main.cpp`. This file contains four
107
-    functions whose results are only partially correct. Your task is to write unit tests for each them to identify their
108
-    wrong results.  **You do not need to rewrite the functions to correct them**.
83
+Step 1: 
84
+Download the proyect from $XYZ$. The proyect contains only one source code file `main.cpp`. This file contains four functions whose results are only partially correct. Your task is to write unit tests for each them to identify their wrong results.  **You do not need to rewrite the functions to correct them**.
109 85
 
110
-    A unit test function `test_fact()` is provided for the function `fact`. If you invoke this function from `main` and
111
-    compile and run the program. You will get the following message:
86
+A unit test function `test_fact()` is provided for the function `fact`. If you invoke this function from `main` and compile and run the program. You will get the following message:
112 87
 
113
-    ```cpp
114
-    Assertion failed: (fact(2) == 2), function test_fact, file ../UnitTests/main.cpp, line 69.
115
-    ``` 
88
+```cpp
89
+Assertion failed: (fact(2) == 2), function test_fact, file ../UnitTests/main.cpp, line 69.
90
+``` 
116 91
 
117
-    This would be enough for us to claim that function `fact` is not correctly implemented. Comment the invocation of
118
-    `test_fact()` from main.
92
+This would be enough for us to claim that function `fact` is not correctly implemented. Comment the invocation of `test_fact()` from main.
119 93
 
120
-    Step 2:
121
-    Write unit tests for the rest of the functions. Remember that you must call each of the unit test functions from the
122
-    `main` for them to run. Copy each of the functions in the provided sheet.
94
+Step 2:
95
+Write unit tests for the rest of the functions. Remember that you must call each of the unit test functions from the `main` for them to run. Copy each of the functions in the provided sheet.
123 96
 
124 97
 
125 98
 ### References
126 99
 
127
-[1] http://nifty.stanford.edu/2005/TestMe/
100
+[1] http://nifty.stanford.edu/2005/TestMe/