Please send questions to
st10@humboldt.edu .
**********************
EDIT EXISTING FUNCTIONS - DONE
**********************
last modified: 12-12-11
Users can bring up the design recipe steps for a function they have
already written, can edit them, and recompile.
STATUS: DONE
FIRST PASSED: 11-29-11 (they completed earlier, though -- took
me a while to get to completing acceptance test for
this)
acceptance tests last attempted: 12-12-11
acceptance tests last passed: 12-12-11
-------------------
acceptance test 1
-------------------
can user start at one time, and finish an unfinished function later?
1. run pre-4 script
...this empties any contents in:
/Users/smtuttle/480xp-tests/come-back-test
2. run:
python3 theGui.pyw
(if necessary:
3. Click "Change directory" and navigate to the following
directory:
/Users/smtuttle/480xp-tests/come-back-test
...and click "Choose".
* make sure you see no functions listed on the right;
)
4. try to create a new function circ_area with problems;
* click "New" button (on right)
* enter the following new function pieces:
circ_area
circ_area: double -> int
<make sure this is 2 lines!>
expects the radius of a circle, and
produces its area
double circ_area(double radius)
* NOW click Save, and close "Function Editor" window;
* exit via the Python menu;
5. again run:
python3 theGUI.pyw
(if necessary:
* Click "Change directory" and navigate to the following
directory:
/Users/smtuttle/480xp-tests/come-back-test
...and click "Choose".
)
* highlight "word" circ_area, NOT check checkbox (you check
checkbox to use function in expression - I still wonder
if this will be confusing to the user... hmm...)
* click Edit button.
* verify: are name, signature, purpose, and header from above
there?
* correct signature to:
circ_area: double -> double
* now fill in named constant declaration, examples, and body,
with an error in body (leave out ;):
const double PI = 3.14159;
circ_area(10) == 314.159
circ_area(1) == 3.14159
{
return PI * (radius * radius)
}
Click "Compile, Test, and Save"; should fail;
* (should see message in bottom: "Function saved. Could not be compiled.")
Click "Save" just to be careful, and close "Function Editor" window.
Now exit theGUI.pyw via the Python menu.
6. again run:
python3 theGUI.pyw
(if necessary:
* Click "Change directory" and navigate to the following
directory:
/Users/smtuttle/480xp-tests/come-back-test
...and click "Choose".
)
* highlight "word" circ_area, NOT check checkbox
* click Edit button.
* verify: are name, signature, purpose, and header from above there?
Is signature now corrected (double -> double)?
are constant, examples and body there, too (with missing ; in body?)
* correct body, adding the needed semicolon:
return PI * (radius * radius);
* Click "Compile, Test, and Save" -- see if now works and tests
pass.
* move windows so you can reach Helper++ window;
* In Helper++ window, NOW click circ_area checkbox,
and see if can now run an expression using this function:
circ_area(10) (and click Execute button)
should give result: 314.159
LAST TESTED: 12-12-11
LAST PASSED: 12-12-11
-------------------
acceptance test 2
-------------------
NASTY TEST?? --
...if user edits HEADER, are BOTH .h and .cpp file corrected?
* asking them -- they think not so nasty! Hopefully so!
(if necessary:
1. run:
python3 theGui.pyw
2. Click "Change directory" and navigate to the following
directory:
/Users/smtuttle/480xp-tests/come-back-test
...and click "Choose".
)
3. In Helper++ window, click "New" button on right, and
try to create a new function triple with problems in header:
triple
triple: double -> double
expects a value, and produces
3 times that value
int triple(int value int triple)
triple(-3) == -9
triple(4.5) == 13.5
{
return 3 * value;
}
Click "Compile, Test and Save" -- should fail;
Decide to stop for now -- click Save again for good measure,
close "Function Editor" window,
and exit theGUI.pyw via the Python menu.
3. again run:
python3 theGUI.pyw
(if necessary:
* Click "Change directory" and navigate to the following
directory:
/Users/smtuttle/480xp-tests/come-back-test
...and click "Choose".
)
* highlight triple (click anywhere on triple instead of clicking
the checkbox)
* click Edit button.
* verify: are design recipe steps from above there?
* correct header to:
double triple(double value)
* Click "Compile, Test, and Save"; does it compile?
Do tests pass?
* move windows around so you can reach Helper++ window;
* See if can now run an expression using this function:
* in Helper++ window, click triple check-box
* enter this expression and click execute:
triple(75)
should give result: 225
LAST TESTED: 12-12-11
LAST PASSED: 12-12-11
-------------------
acceptance test 3
-------------------
Can user correct erroneous examples and results, and add
examples/expected results?
(if necessary:
1. run:
python3 theGUI.pyw
* Click "Change directory" and navigate to the following
directory:
/Users/smtuttle/480xp-tests/come-back-test
...and click "Choose".
)
2. try to create a new function abs_val with one buggy example:
* click New button on lower-right of Helper++ window
* enter the following for new function abs_val:
abs_val
abs_val: int -> int
expects an integer, and produces the absolute value
of that integer
int abs_val(int value)
abs_val(2) == 4 // wrong value
abs val -2 == 2 // bad syntax
{
if (value < 0)
return -1 * value;
else
return value;
}
* click "Compile, Test and Save"; should compile, but
both tests should indicate failed;
12-12-11: both say "false", indeed indicating failed tests;
* close failed-test window (by clicking OK button),
click Save for good measure, close the "Function Editor"
window, and exit theGUI.pyw via the Python menu;
3. again run:
python3 theGUI.pyw
(if necessary:
* Click "Change directory" and navigate to the following
directory:
/Users/smtuttle/480xp-tests/come-back-test
...and click "Choose".
)
* highlight abs_val on right
* click Edit button.
* verify: are design recipe steps from above there?
* correct examples to:
abs_val(2) == 2
abs_val(-2) == 2
and add 1 more example:
abs_val(0) == 0
* Click "Compile, Test and Save"; it should compile,
and all 3 tests should pass;
* Now move the windows so you can reach Helper++,
click the abs_val checkbox on right,
and see if can now run an expression using this function:
abs_val(-478) (and click Execute)
should give result: 478
LAST TESTED: 12-12-11
LAST PASSED: 12-12-11