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

Add files WhiteBoxtesting #53

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions src/toptal/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
White Box Testing to function solution

if (a == null || a.length == 0)

(1.1) (1.2)
return 0 (1.3)

if (a.length == 1)
(2 )

return 1 (3)

Set seta (4)

Set setb (5)

Set setc (6)

Set setd (7)

for (8)

double d (9)

int x (10)

int y (11)

if (x > 0 && y > 0) (12)

seta.add (12.1)

else if (x < 0 && y > 0)(13)

setb.add(13.1)

else if (x < 0 && y < 0) (14)

setc.add(14.1)

else (15)

setd.add(15.1)

return 16

=> Case Test

T1:(1.1) (1.3)
T2:(1.1) (1.2) (1.3)
T3:(1) (2) (3)
T4:(1) (2) (4) (5) (6) (7) (8) (9) (10) (11) (12) (12.1)
(9) (10) (11) (12) (13) (13.1)
(9) (10) (11) (12) (13) (14) (14.1)
(9) (10) (11) (12) (13) (14) (15) (15.1) (16)
T5:(1) (2) (4) (5) (6) (7) (8) (9) (10) (11) (12) (12.1)
(9) (10) (11) (12) (12.1)
(9) (10) (11) (12) (12.1) (16)
..T6,T7,T8 similar T5



54 changes: 54 additions & 0 deletions src/toptal/TestingJunit.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import org.junit.Assert;
import org.junit.Test;
// White Box Testing
public class TestingJunit {
First first =new First();

// Test if (a == null || a.length == 0)
@Test
public void TestFirst1(){
Assert.assertEquals(0,first.solution(null));
}

// Test if (a == null || a.length == 0)
@Test
public void TestFirst2(){
Assert.assertEquals(0,first.solution([]));
}

// Test if (a.length == 1)
@Test
public void TestFirst3(){
Assert.assertEquals(1,first.solution([{1,1}]);
}

// Test for and if
@Test
public void TestFirst4(){
Assert.assertEquals(4,first.solution([{1,1},{-1,1},{-1,-1},{1,-1}]));
}

// Test seta.add
@Test
public void TestFirst5(){
Assert.assertEquals(2,first.solution([{1,1},{4,4},{1,4}]));
}

// Test setb.add
@Test
public void TestFirst6(){
Assert.assertEquals(2,first.solution([{-1,1},{-4,4},{-1,4}]));
}

// Test setc.add
@Test
public void TestFirst7(){
Assert.assertEquals(2,first.solution([{-1,-1},{-4,-4},{-1,-4}]));
}

// Test setd.add
@Test
public void TestFirst8(){
Assert.assertEquals(2,first.solution([{1,-1},{4,-4},{1,-4}]));
}
}