=====
CS 111 - Week 3 Labs - 2024-09-13
=====

=====
TODAY WE WILL
=====
*   announcements/prep for next class
*   quick mention: check-within
*   review clicker questions
*   Week 3 Lab Exercise

=====
*   should be finishing Homework 2,
    or at least get first attempts in by 11:59 pm tonight,
    Friday, September 13;

*   will send class e-mail when Homework 3 is posted
    *   deadline will be 11:59 pm on Friday, September 20

=====
check-within
=====
*   can be useful when testing a function that returns a number with a
    fractional part!

    (because when representing a real number in a
    computer, the computer may have to approximate
    it -- the computer can't represent ALL of the significant
    digits of a repeating decimal, for example)

*   check-expect expects an expression to test,
    and an expression with the same value (hopefully!);
    *   the arguments' values have to be EXACTLY equal for the test
        to pass

*   check-within still has those first two arguments,
    but also adds a third: the acceptable difference
    between the first 2 arguments
    *   the difference between the first two arguments'
        values needs to be less than or equal to the acceptable
	value to pass

    *   when writing a test using check-within,
        you decide what is "close enough" to be considered a passing test,
	based on what's appropriate for that function and how it is to
	be used;

    ;=====
    ; fails, because (/ 1 3) is not EXACTLY the same as 0.3333333

    (check-expect (/ 1 3)
                  0.3333333)

    ;=====
    ; passes, because (/ 1 3) is within 0.01 of 0.3333333

    (check-within (/ 1 3)
                  0.3333333
		  0.01)

    ;=====
    ; fails, because (/ 1 3) is NOT within 0.00000001 of 0.3333333

    (check-within (/ 1 3)
                  0.3333333
                  0.00000001)