Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
GoikLectures
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Goik Martin
GoikLectures
Commits
8db8d936
Commit
8db8d936
authored
9 years ago
by
Goik Martin
Browse files
Options
Downloads
Patches
Plain Diff
Suppress "potentially static" warning
parent
79439d50
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
P/Sd1/Array/integerStoreUnbounded/src/test/java/de/hdm_stuttgart/mi/sd1/fraction/IntStoreTest.java
+38
-37
38 additions, 37 deletions
...t/java/de/hdm_stuttgart/mi/sd1/fraction/IntStoreTest.java
with
38 additions
and
37 deletions
P/Sd1/Array/integerStoreUnbounded/src/test/java/de/hdm_stuttgart/mi/sd1/fraction/IntStoreTest.java
+
38
−
37
View file @
8db8d936
...
...
@@ -8,41 +8,42 @@ import de.hdm_stuttgart.mi.sd1.store.IntegerStore;
@SuppressWarnings
(
"javadoc"
)
public
class
IntStoreTest
{
@Test
public
void
testPositiveNegative
()
{
final
int
capacity
=
3
;
IntegerStore
store
=
new
IntegerStore
(
capacity
);
assertEquals
(
capacity
,
store
.
getCapacity
());
// The store's initial capacity
assertEquals
(
0
,
store
.
getNumValues
());
// Store is initially empty
final
int
v1
=
-
17
,
v2
=
3
,
v3
=
-
4
,
v4
=
7
;
store
.
addValue
(
v1
);
// Add a single value
assertEquals
(
1
,
store
.
getNumValues
());
// Store contains one value
assertEquals
(
v1
,
store
.
getValue
(
0
));
// Value should be present at index 0
store
.
addValue
(
v2
);
// Add two more values
store
.
addValue
(
v3
);
assertEquals
(
capacity
,
store
.
getCapacity
());
// The store's initial capacity
assertEquals
(
3
,
store
.
getNumValues
());
// Store contains three values
assertEquals
(
v1
,
store
.
getValue
(
0
));
// Retrieve all values
assertEquals
(
v2
,
store
.
getValue
(
1
));
assertEquals
(
v3
,
store
.
getValue
(
2
));
// Now we breach the container's initial capacity
store
.
addValue
(
v4
);
assertEquals
(
2
*
capacity
,
store
.
getCapacity
());
// Twice the store's initial capacity
// add 99996 more values
for
(
int
i
=
4
;
i
<
100_000
;
i
++)
{
store
.
addValue
(
i
);
}
assertEquals
(
100_000
,
store
.
getNumValues
());
assertTrue
(
100_000
<=
store
.
getCapacity
());
// Capacity should at least be 100_000
}
@SuppressWarnings
(
"static-method"
)
@Test
public
void
testPositiveNegative
()
{
final
int
capacity
=
3
;
IntegerStore
store
=
new
IntegerStore
(
capacity
);
assertEquals
(
capacity
,
store
.
getCapacity
());
// The store's initial capacity
assertEquals
(
0
,
store
.
getNumValues
());
// Store is initially empty
final
int
v1
=
-
17
,
v2
=
3
,
v3
=
-
4
,
v4
=
7
;
store
.
addValue
(
v1
);
// Add a single value
assertEquals
(
1
,
store
.
getNumValues
());
// Store contains one value
assertEquals
(
v1
,
store
.
getValue
(
0
));
// Value should be present at index 0
store
.
addValue
(
v2
);
// Add two more values
store
.
addValue
(
v3
);
assertEquals
(
capacity
,
store
.
getCapacity
());
// The store's initial capacity
assertEquals
(
3
,
store
.
getNumValues
());
// Store contains three values
assertEquals
(
v1
,
store
.
getValue
(
0
));
// Retrieve all values
assertEquals
(
v2
,
store
.
getValue
(
1
));
assertEquals
(
v3
,
store
.
getValue
(
2
));
// Now we breach the container's initial capacity
store
.
addValue
(
v4
);
assertEquals
(
2
*
capacity
,
store
.
getCapacity
());
// Twice the store's initial capacity
// add 99996 more values
for
(
int
i
=
4
;
i
<
100_000
;
i
++)
{
store
.
addValue
(
i
);
}
assertEquals
(
100_000
,
store
.
getNumValues
());
assertTrue
(
100_000
<=
store
.
getCapacity
());
// Capacity should at least be 100_000
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment