int_function_examples¶
This script provides several examples of how one can use the test helper package to validate functions that return integer values. The optional runtime arguments below allow the user to select which integer examples they would like to run. If no runtime flags are used, this script will run all of the built-in integer examples.
Parameters¶
- —run_return_zero_demobool, default False
Boolean flag for whether the return zero function example should be run.
- —run_return_int_plus_one_demobool, default False
Boolean flag for whether the return int plus one function example should be run.
- —run_return_neg_int_demobool, default False
Boolean flag for whether the return negative integer function example should be run.
- —run_return_string_length_demobool, default False
Boolean flag for whether the return string length function example should be run.
- —run_add_ints_demobool, default False
Boolean flag for whether the add integers function example should be run.
- —run_calc_int_list_sum_demobool, default False
Boolean flag for whether the calculate list sum function example should be run.
Module Contents¶
Functions¶
Returns zero. |
|
Returns the input parameter int_val plus one. |
|
Returns the negative of the input parameter int_val. |
|
Returns the length of the string parameter input_str. |
|
Returns the sum of two integers (int1 and int2). |
|
Returns the sum of all integers in a list of integers (input_list). |
Data¶
Runtime argument parser |
|
Parsed runtime arguments |
|
Runtime flag for whether we should run the return zero function example |
|
Runtime flag for whether we should run the return int plus one function example |
|
Runtime flag for whether we should run the return negative integer function example |
|
Runtime flag for whether we should run the return string length function example |
|
Runtime flag for whether we should run the add integers function example |
|
Runtime flag for whether we should run the calculate integer list sum function example |
|
Boolean for whether any demos were requested by the user (through the runtime arguments) |
|
Boolean for whether all demos should be run (default behaviour if no specific demos are requested) |
API¶
- int_function_examples.parser = 'ArgumentParser(...)'¶
Runtime argument parser
- int_function_examples.args = 'parse_args(...)'¶
Parsed runtime arguments
- int_function_examples.run_return_zero_demo = None¶
Runtime flag for whether we should run the return zero function example
- int_function_examples.run_return_int_plus_one_demo = None¶
Runtime flag for whether we should run the return int plus one function example
- int_function_examples.run_return_neg_int_demo = None¶
Runtime flag for whether we should run the return negative integer function example
- int_function_examples.run_return_string_length_demo = None¶
Runtime flag for whether we should run the return string length function example
- int_function_examples.run_add_ints_demo = None¶
Runtime flag for whether we should run the add integers function example
- int_function_examples.run_calc_int_list_sum_demo = None¶
Runtime flag for whether we should run the calculate integer list sum function example
- int_function_examples.any_demos = None¶
Boolean for whether any demos were requested by the user (through the runtime arguments)
- int_function_examples.run_all_demos = None¶
Boolean for whether all demos should be run (default behaviour if no specific demos are requested)
- int_function_examples.return_zero()¶
Returns zero.
- int_function_examples.return_int_plus_one(int_val)¶
Returns the input parameter int_val plus one.
- int_function_examples.return_neg_int(int_val)¶
Returns the negative of the input parameter int_val.
- int_function_examples.return_string_length(input_str)¶
Returns the length of the string parameter input_str.
- int_function_examples.add_ints(int1, int2)¶
Returns the sum of two integers (int1 and int2).
- int_function_examples.calc_int_list_sum(input_list)¶
Returns the sum of all integers in a list of integers (input_list).