Please send questions to st10@humboldt.edu .
**********************
FUNCTION CREATION - DONE
**********************
last modified: 12-12-11

Student creates a function by following the design recipe: 
enter function name first,
then enter signature,
then purpose statement,
then function header,
then example calls and their results,
then function body.

STATUS: DONE
FIRST PASSED: 11-17-11
acceptance tests last attempted: 12-12-11
acceptance tests last passed:    12-12-11

-------------------
acceptance test 1
-------------------
see if simple function creation following the design recipe steps works.

1. run pre-3 script

2. run:
   python3 theGui.pyw

(if necessary:
3. Click "Change directory" and navigate to the following
   directory:
   /Users/smtuttle/480xp-tests/new-test
   ...and click "Choose".
4. Check: there should be no functions listed on the right.
)

5. push New button, try to create a new function circ_area:

circ_area

circ_area: double -> double

<make sure this is multiple-lines!!>   
expects the radius of a circle, and produces the area
of a circle with that radius

double circ_area(double radius)

const double PI = 3.14159;

circ_area(10) == 314.159
circ_area(1) == 3.14159
   
{
    return PI * (radius * radius);
}

6. Click "Compile, Test and Save";
   See if compiles and if all tests pass.
 
7. See if can now run an expression using this function:
   *   move windows around so you have the Helper++ window
   *   now, in Helper++:
       *   click circ_area's checkbox  on the right;

       *   enter the expression:

           circ_area(10)

           ...and click Execute.

   should give result: 314.159

LAST TESTED: 12-12-11
LAST PASSED: 12-12-11

-------------------
acceptance test 2
-------------------
see if entering design recipe steps out-of-order is not permitted.

(if needed:
1. run:
   python3 theGUI.pyw

2. click "Change directory", and navigate to:
   /Users/smtuttle/480xp-tests/new-test
)

3. try to create a new function triple...
   *  in Helper++, click "New" button to get new Function Set Up window

   *  try to first enter the function body.
      *   Verify that this is not permitted.

   *  try to first enter examples and their results.
      *   Verify that this is not permitted.

   *  try to first enter function header.
      *   Verify that this is not permitted.

   *   try to first enter purpose.
       *   Verify that this is not permitted.

   *   try to first enter function signature.
       *   Verify that this is not permitted.

   *   try to enter function name: 
triple
       *   Verify that this IS permitted!

4. Now that function name has been given:
   *  try to next enter the function body.
      *   Verify that this is not permitted.

   *  try to next enter examples and their results.
      *   Verify that this is not permitted.

   *  try to next enter function header.
      *   Verify that this is not permitted.

   *   try to next enter purpose.
       *   Verify that this is not permitted.

   *   try to next enter function signature.
       *   Verify that this IS permitted!: 
triple: double -> double

5. Now that function name and signature have been given:
   *  try to next enter the function body.
      *   Verify that this is not permitted.

   *  try to next enter examples and their results.
      *   Verify that this is not permitted.

   *  try to next enter function header.
      *   Verify that this is not permitted.

   *   try to next enter purpose.
       *   Verify that this IS permitted!: (make sure this is TWO lines!)
expects a value, and produces
3 times that value

6. Now that function name, signature, and purpose have been given:
   *  try to next enter the function body.
      *   Verify that this is not permitted.

   *  try to next enter examples and their results.
      *   Verify that this is not permitted.

   *  try to next enter function header.
       *   Verify that this IS permitted!:
double triple(double value)

7. Now that function name, signature, purpose, and header have been given:
   *  try to next enter the function body.
      *   Verify that this is not permitted.

   *  try to next enter examples and their results.
       *   Verify that this IS permitted!
triple(4.5) == 13.5
triple(-3) == -9

8. Now that function name, signature, purpose, header, and examples
   and their results have been given:
   *  try to next enter the function body.
       *   Verify that this IS permitted!
{
    return 3 * value;
}

9. Click "Compile, Test and Save";
   See if compiles and if tests pass.

10. See if can now run an expression using this function:
   *   move windows so that you can use Helper++ window
   *   unclick circ_area
   *   click triple

   *   enter expression: triple(100)
       click Execute
       should give result: 300

11. You can't run circ_area if it isn't clicked, can you?
    enter expression: circ_area(10)
    click Execute
    ...shouldn't we get "Bad expression"? Make sure this is so;

12. See if can now run an expression using both of these
    functions:
    *   click circ_area (so both circ_area and triple are clicked)

    *   enter expression: triple(circ_area(10))
    *   click Execute
    *   make sure we get 942.477;

*   exit via the Python menu;

*   AT END: run the script 
post-3
    ...to save "modern" versions of circ_area and triple for
    later acceptance tests;

LAST TESTED: 12-12-11
LAST PASSED: 12-12-11