reset password
Author Message
ckan3
Posts: 2
Posted 21:24 Nov 20, 2012 |

 

Hi,

Can anyone explain to me what "testing a method" refers to exactly? 

For example, do we just write a main method that calls the method many times with different arguments to test the different scenarios that can occur? 

Thank you! 

Last edited by ckan3 at 21:43 Nov 20, 2012.
redge
Posts: 31
Posted 21:41 Nov 20, 2012 |

Generally, yes, that's appropriate. Testing a method, function, program, or pretty much anything else usually refers to testing every aspect of it and checking that the results are what they should be. In 201, that usually amounts to invoking every method, constructor, etc and printing the results of everything you do so you (or the professor) can check visually that the data is what it should be.

 

If you're interested, there are things called JUnit tests that do the checking for you, but they're well beyond the scope of that class.

jpascua
Posts: 197
Posted 22:02 Nov 20, 2012 |

I understood the assignment the same way you did CKAN.

ckan3
Posts: 2
Posted 22:07 Nov 20, 2012 |

Okay thank you! 

For the second portion of the lab, did you put the content of the new array(the combined array1 and array2) in numerical order or just in any random order? 

jpascua
Posts: 197
Posted 22:18 Nov 20, 2012 |

I believe it has to be the same order the original two arrays were in. That's how I did it. 

Array 1: 1 2 3 4

Array 2: 8 7 6 1

Combined Array: 1 2 3 4 8 7 6 1