✨ feat: 添加 list 实现与测试,添加 stack 测试
This commit is contained in:
21
tests/test-stack.cpp
Normal file
21
tests/test-stack.cpp
Normal file
@@ -0,0 +1,21 @@
|
||||
#include <iostream>
|
||||
#include <stack>
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
std::stack<int> stack;
|
||||
stack.push(1);
|
||||
stack.push(2);
|
||||
stack.push(3);
|
||||
std::cout << "Current stack size: "<< stack.size() << std::endl;
|
||||
std::cout << "Stack is empty? "<< stack.empty() << std::endl;
|
||||
while (!stack.empty())
|
||||
{
|
||||
std::cout << stack.top() << " ";
|
||||
stack.pop();
|
||||
}
|
||||
std::cout << std::endl;
|
||||
|
||||
// system("pause");
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user