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

return_zero

Returns zero.

return_int_plus_one

Returns the input parameter int_val plus one.

return_neg_int

Returns the negative of the input parameter int_val.

return_string_length

Returns the length of the string parameter input_str.

add_ints

Returns the sum of two integers (int1 and int2).

calc_int_list_sum

Returns the sum of all integers in a list of integers (input_list).

Data

parser

Runtime argument parser

args

Parsed runtime arguments

run_return_zero_demo

Runtime flag for whether we should run the return zero function example

run_return_int_plus_one_demo

Runtime flag for whether we should run the return int plus one function example

run_return_neg_int_demo

Runtime flag for whether we should run the return negative integer function example

run_return_string_length_demo

Runtime flag for whether we should run the return string length function example

run_add_ints_demo

Runtime flag for whether we should run the add integers function example

run_calc_int_list_sum_demo

Runtime flag for whether we should run the calculate integer list sum function example

any_demos

Boolean for whether any demos were requested by the user (through the runtime arguments)

run_all_demos

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).