Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TDD on For Loops #14

Closed
fengyuanyang opened this issue Oct 12, 2020 · 6 comments · Fixed by #19
Closed

TDD on For Loops #14

fengyuanyang opened this issue Oct 12, 2020 · 6 comments · Fixed by #19
Assignees
Labels
good first issue Good for newcomers hacktoberfest welcome to hacktoberfest help wanted Extra attention is needed

Comments

@fengyuanyang
Copy link
Owner

Background
It's a good start to learn some java For Loops.

How
Write ForLoopTest unit tests,
includes

for (statement 1; statement 2; statement 3) 
for each loop :
for (type variableName : arrayName) 

DoD
All the unittests include all the statements mentioned above

@fengyuanyang fengyuanyang added good first issue Good for newcomers hacktoberfest welcome to hacktoberfest help wanted Extra attention is needed labels Oct 12, 2020
@Shweta200126
Copy link

Can you explain a little more ...

@fengyuanyang
Copy link
Owner Author

Hi @Shweta200126
Thanks for asking .
There are two types of for loops

  1. Java For loop
  2. For-each loop

You could create some unit tests first such as

For Java For Loop

1. 
Given 2 parameters (start, end)
When start = 0, end = 12
Expect execute 12 times 
And Return 12;
ex. for ( int i=start;i<end;i++)

2. 
Given 3 parameters (start, end, plus)
When start = 0, end = 12, plus=2
Expect execute x times 
And Return x;
ex. for ( int i=start;i<=end;i=i+plus)

... others you can imagine on your mind.

For Java For-Each Loop

1. 
Given 1 parameters (String Array)
When Array Size is 12
Expect execute 12 times 
And Return 12;
ex. for (String str: strArray).

2. 
Given 1 parameter (int Array)
When Array Size is 12
Expect sum all the integer values 
And Return SUM

@btirumala1219
Copy link

I can take a look at this

@fengyuanyang
Copy link
Owner Author

Thanks @btirumala1219
I have assigned to you

@btirumala1219
Copy link

#19

@fengyuanyang fengyuanyang linked a pull request Oct 13, 2020 that will close this issue
@btirumala1219
Copy link

lmk if anything else you can assign

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers hacktoberfest welcome to hacktoberfest help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants