[DEV] continue removing stl
This commit is contained in:
parent
bf044da356
commit
fa16d76623
@ -5,7 +5,7 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
#include <etk/Vector.hpp>
|
||||
#include <mutex>
|
||||
#include <ememory/SharedPtr.hpp>
|
||||
#include <ememory/WeakPtr.hpp>
|
||||
|
@ -5,7 +5,7 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
#include <etk/Vector.hpp>
|
||||
#include <mutex>
|
||||
#include <ememory/debug.hpp>
|
||||
#include <ememory/Counter.hpp>
|
||||
|
@ -5,7 +5,7 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
#include <etk/Vector.hpp>
|
||||
#include <mutex>
|
||||
#include <ememory/debug.hpp>
|
||||
#include <ememory/Counter.hpp>
|
||||
|
@ -5,7 +5,7 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
#include <etk/Vector.hpp>
|
||||
#include <mutex>
|
||||
#include <ememory/SharedPtr.hpp>
|
||||
#include <ememory/WeakPtr.hpp>
|
||||
|
@ -5,7 +5,7 @@
|
||||
*/
|
||||
|
||||
#include <test-debug/debug.hpp>
|
||||
#include <vector>
|
||||
#include <etk/Vector.hpp>
|
||||
#include <gtest/gtest.h>
|
||||
#include <etk/etk.hpp>
|
||||
|
||||
@ -14,7 +14,7 @@ int main(int _argc, const char *_argv[]) {
|
||||
::testing::InitGoogleTest(&_argc, const_cast<char **>(_argv));
|
||||
etk::init(_argc, _argv);
|
||||
for (int32_t iii=0; iii<_argc ; ++iii) {
|
||||
std::string data = _argv[iii];
|
||||
etk::String data = _argv[iii];
|
||||
if ( data == "-h"
|
||||
|| data == "--help") {
|
||||
TEST_PRINT(_argv[0] << " - help : ");
|
||||
|
@ -9,7 +9,7 @@
|
||||
#include "main.hpp"
|
||||
|
||||
TEST(TestShared, createAndDestroy) {
|
||||
ememory::SharedPtr<std::string> data = ememory::makeShared<std::string>("coucou");
|
||||
ememory::SharedPtr<etk::String> data = ememory::makeShared<etk::String>("coucou");
|
||||
EXPECT_EQ(data.useCount(), 1);
|
||||
EXPECT_EQ(*data, "coucou");
|
||||
EXPECT_EQ(data == nullptr, false);
|
||||
@ -21,10 +21,10 @@ TEST(TestShared, createAndDestroy) {
|
||||
}
|
||||
|
||||
TEST(TestShared, copy) {
|
||||
ememory::SharedPtr<std::string> data = ememory::makeShared<std::string>("coucou");
|
||||
ememory::SharedPtr<etk::String> data = ememory::makeShared<etk::String>("coucou");
|
||||
EXPECT_EQ(data.useCount(), 1);
|
||||
EXPECT_EQ(*data, "coucou");
|
||||
ememory::SharedPtr<std::string> dataCopy = data;
|
||||
ememory::SharedPtr<etk::String> dataCopy = data;
|
||||
EXPECT_EQ(data.useCount(), 2);
|
||||
EXPECT_EQ(data == dataCopy, true);
|
||||
EXPECT_EQ(data != dataCopy, false);
|
||||
@ -41,10 +41,10 @@ TEST(TestShared, copy) {
|
||||
}
|
||||
|
||||
TEST(TestShared, swap) {
|
||||
ememory::SharedPtr<std::string> data = ememory::makeShared<std::string>("coucou");
|
||||
ememory::SharedPtr<etk::String> data = ememory::makeShared<etk::String>("coucou");
|
||||
EXPECT_EQ(data.useCount(), 1);
|
||||
EXPECT_EQ(*data, "coucou");
|
||||
ememory::SharedPtr<std::string> dataCopy;
|
||||
ememory::SharedPtr<etk::String> dataCopy;
|
||||
EXPECT_EQ(dataCopy.useCount(), 0);
|
||||
dataCopy.swap(data);
|
||||
EXPECT_EQ(data.useCount(), 0);
|
||||
@ -53,16 +53,16 @@ TEST(TestShared, swap) {
|
||||
}
|
||||
|
||||
TEST(TestShared, callOperator) {
|
||||
ememory::SharedPtr<std::string> data = ememory::makeShared<std::string>("coucou");
|
||||
ememory::SharedPtr<etk::String> data = ememory::makeShared<etk::String>("coucou");
|
||||
EXPECT_EQ(data->size(), 6);
|
||||
}
|
||||
|
||||
static void functionCallRef(std::string& _data) {
|
||||
static void functionCallRef(etk::String& _data) {
|
||||
_data = "plop";
|
||||
}
|
||||
|
||||
TEST(TestShared, callOperatorStar) {
|
||||
ememory::SharedPtr<std::string> data = ememory::makeShared<std::string>("coucou");
|
||||
ememory::SharedPtr<etk::String> data = ememory::makeShared<etk::String>("coucou");
|
||||
EXPECT_EQ(data->size(), 6);
|
||||
EXPECT_EQ(*data, "coucou");
|
||||
*data = "ragout";
|
||||
@ -74,7 +74,7 @@ TEST(TestShared, callOperatorStar) {
|
||||
}
|
||||
|
||||
TEST(TestShared, setInVoid) {
|
||||
ememory::SharedPtr<std::string> data = ememory::makeShared<std::string>("coucou");
|
||||
ememory::SharedPtr<etk::String> data = ememory::makeShared<etk::String>("coucou");
|
||||
ememory::SharedPtr<void> dataVoid(data);
|
||||
ememory::SharedPtr<void> dataVoid2;
|
||||
dataVoid2 = data;
|
||||
|
@ -9,9 +9,9 @@
|
||||
#include "main.hpp"
|
||||
|
||||
TEST(TestWeak, createAndDestroy) {
|
||||
ememory::SharedPtr<std::string> data = ememory::makeShared<std::string>("coucou");
|
||||
ememory::SharedPtr<etk::String> data = ememory::makeShared<etk::String>("coucou");
|
||||
EXPECT_EQ(data.useCount(), 1);
|
||||
ememory::WeakPtr<std::string> dataWeak = data;
|
||||
ememory::WeakPtr<etk::String> dataWeak = data;
|
||||
EXPECT_EQ(data.useCount(), 1);
|
||||
EXPECT_EQ(dataWeak.useCount(), 1);
|
||||
data.reset();
|
||||
@ -20,12 +20,12 @@ TEST(TestWeak, createAndDestroy) {
|
||||
}
|
||||
|
||||
TEST(TestWeak, retrive) {
|
||||
ememory::SharedPtr<std::string> data = ememory::makeShared<std::string>("coucou");
|
||||
ememory::SharedPtr<etk::String> data = ememory::makeShared<etk::String>("coucou");
|
||||
EXPECT_EQ(data.useCount(), 1);
|
||||
ememory::WeakPtr<std::string> dataWeak = data;
|
||||
ememory::WeakPtr<etk::String> dataWeak = data;
|
||||
EXPECT_EQ(data.useCount(), 1);
|
||||
EXPECT_EQ(dataWeak.useCount(), 1);
|
||||
ememory::SharedPtr<std::string> dataRetrive = dataWeak.lock();
|
||||
ememory::SharedPtr<etk::String> dataRetrive = dataWeak.lock();
|
||||
EXPECT_EQ(data.useCount(), 2);
|
||||
EXPECT_EQ(dataWeak.useCount(), 2);
|
||||
data.reset();
|
||||
|
Loading…
Reference in New Issue
Block a user