In this exercise I'm using Visual Studio 2019 and a modified version of the std_lib_facilities header found here.
Chapter 26 // Drill 2
Complete a file of tests for the sequences from section 26.3.
Complete a file of tests for the sequences from section 26.3.
a. { 1 2 3 5 8 13 21 } // an ordinary sequence
b. { } // an empty sequence
c. { 1 } // just one element
d. { 1 2 3 4 } // even number of elements
e. { 1 2 3 4 5} // odd number of elements
f. {1 1 1 1 1 1 1 } // all elements equal
g. { 0 1 1 1 1 1 1 1 1 1 1 1 } // different element at beginning
h. { 0 0 0 0 0 0 0 0 0 0 0 0 1 } // different element at end
The one thing that tripped me up was the for loop in testAll. I forgot to clear the Test struct each time, so it's sequence vector always had the incorrect numbers in it!
No comments:
Post a Comment