#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ @author: aaron """ import total_peaks as tp # ------- TEST CASES ------------------ # Some example test data defined below. # You need to create some more of your own. # Copy the format, but change the values. # To change which test case is used, skip below to the main module. def test1(): """ An example from the assignment spec. """ data_series = [0, 0, -2, 2, -2, 2, 0, 1, 41, 38, 22, 10, -1, 3,-1, 2, -2, 3, 2, 3] smoothing = 8 th = 3.0 influence = 0.0 expected_answer = 1 return data_series, smoothing, th, influence, expected_answer def test2(): """ The input series from the assignment spec repeated. """ data_series = [0, 0, -2, 2, -2, 2, 0, 1, 41, 38, 22, 10, -1, 3,-1, 2, -2, 3, 2, 3, 0, 0, -2, 2, -2, 2, 0, 1, 41, 38, 22, 10, -1, 3,-1, 2, -2, 3, 2, 3] smoothing = 8 th = 3.0 influence = 0.0 expected_answer = 2 return data_series, smoothing, th, influence, expected_answer def test3(): """ Something with a few more peaks """ data_series = [0,0,-2,2,-2,2,0, 1, 10, 15, 3, 0, 7, 9, 3 , 2, 7, 12, 2, 1] smoothing = 8 th = 3.0 influence = 0.0 expected_answer = 3 return data_series, smoothing, th, influence, expected_answer ################################################### # --- CHECK OUTPUT ------------------ # This function compares two values # Check your output against expected output, and report the result def check_output(result, expected_answer): if result == expected_answer: print('GOOD JOB you counted all the peaks YAY!!!!! =)') else: print('Oh noooo, you missed some peaks. Please try again.') # ---- MAIN MODULE -------------------- # This is the main code that performs the test print('TESTING FUNCTION: total_peaks') # Select Your Test, you can select one at a time # TODO change the test to run a different test at a time data_series, smoothing, th, influence, expected_answer = test1() #data_series, smoothing, th, influence, expected_answer = test2() #data_series, smoothing, th, influence, expected_answer = test3() # Let's call your function! result = tp.total_peaks(data_series, smoothing, th, influence) # Let's check your output against expected output, and report the result check_output(result, expected_answer) # -------- end ---------------