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

[2_1] Unit tests on long array #193

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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
14 changes: 14 additions & 0 deletions tests/Kernel/Containers/array_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,3 +101,17 @@ TEST_CASE ("test contains") {
CHECK_EQ (contains (2, five_elem), true);
CHECK_EQ (contains (3, five_elem), true);
}

TEST_CASE ("long array") {
int arr_size = 10000000;
int initial_mem_used= mem_used ();
cout << "Initial mem used: " << initial_mem_used << LF;
array<string> long_arr= array<string> ();
for (int i= 0; i < arr_size; i++) {
long_arr << string ("88888888");
}
int final_mem_used= mem_used ();
cout << "Final mem used: " << final_mem_used << LF;
cout << "Actual mem used: " << final_mem_used - initial_mem_used << LF;
CHECK_EQ (arr_size, N (long_arr));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this statement always passed?

}