Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
HFTSoftwareProject
testcases
Commits
92fcb256
Commit
92fcb256
authored
Sep 24, 2024
by
Younis
Browse files
Add new file TwoSumsTest
parent
739e6112
Changes
1
Hide whitespace changes
Inline
Side-by-side
TwoSumsTest.java
0 → 100644
View file @
92fcb256
import
static
org
.
junit
.
Assert
.*;
import
org.junit.Test
;
public
class
TwoSumsTest
{
@Test
public
void
testStudentOneSolution
()
{
int
[]
nums
=
{
2
,
7
,
11
,
15
};
int
target
=
18
;
int
[][]
expectedPairs
=
{{
2
,
16
},
{
7
,
11
}};
int
[][]
expectedIndices
=
{{
0
,
3
},
{
1
,
2
}};
// Replace StudentOneSolution with the actual name of the class submitted by the first student
int
[][]
actualPairs
=
StudentOneSolution
.
findPairs
(
nums
,
target
);
int
[][]
actualIndices
=
StudentOneSolution
.
findIndices
(
nums
,
target
);
assertArrayEquals
(
expectedPairs
,
actualPairs
);
assertArrayEquals
(
expectedIndices
,
actualIndices
);
}
@Test
public
void
testStudentTwoSolution
()
{
int
[]
nums
=
{
2
,
7
,
11
,
15
};
int
target
=
18
;
int
[][]
expectedPairs
=
{{
2
,
16
},
{
7
,
11
}};
int
[][]
expectedIndices
=
{{
0
,
3
},
{
1
,
2
}};
// Replace StudentTwoSolution with the actual name of the class submitted by the second student
int
[][]
actualPairs
=
StudentTwoSolution
.
findPairs
(
nums
,
target
);
int
[][]
actualIndices
=
StudentTwoSolution
.
findIndices
(
nums
,
target
);
assertArrayEquals
(
expectedPairs
,
actualPairs
);
assertArrayEquals
(
expectedIndices
,
actualIndices
);
}
@Test
public
void
testStudentThreeSolution
()
{
int
[]
nums
=
{
2
,
7
,
11
,
15
};
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment