Просмотр исходного кода

build: reactivate array::Insert.

undefined
Sam Hocevar 10 лет назад
Родитель
Сommit
2b3f1aa0d5
2 измененных файлов: 17 добавлений и 23 удалений
  1. +3
    -4
      src/lol/base/array.h
  2. +14
    -19
      src/t/base/array.cpp

+ 3
- 4
src/lol/base/array.h Просмотреть файл

@@ -481,11 +481,11 @@ public:
}
++this->m_count;
}
/*
inline void Insert(ptrdiff_t pos, T... args)
{
//ASSERT(pos >= 0);
//ASSERT(pos <= this->m_count);
ASSERT(pos >= 0);
ASSERT(pos <= this->m_count);

if (this->m_count >= this->m_reserved)
this->Grow();
@@ -498,7 +498,6 @@ public:
new (&this->m_data[pos]) tuple<T...>({ args... });
++this->m_count;
}
*/
};

template<typename T>


+ 14
- 19
src/t/base/array.cpp Просмотреть файл

@@ -188,33 +188,28 @@ lolunit_declare_fixture(ArrayTest)
lolunit_assert_equal(7, a[2]);
lolunit_assert_equal(2, a[3]);
lolunit_assert_equal(6, a[4]);
}

/*
array<int, int, int> b;
b.Insert(0, 5, 6, 7);
lolunit_declare_test(ArrayInsertTuple)
{
array<int, float, String> b;
b.Insert(0, 5, 6.f, "lol");
lolunit_assert_equal(5, b[0].m1);
lolunit_assert_equal(6, b[0].m2);
lolunit_assert_equal(7, b[0].m3);
lolunit_assert_equal(6.f, b[0].m2);

b.Insert(1, 8, 9, 6);
b.Insert(1, 8, 9.f, "hi there");
lolunit_assert_equal(5, b[0].m1);
lolunit_assert_equal(6, b[0].m2);
lolunit_assert_equal(7, b[0].m3);
lolunit_assert_equal(6.f, b[0].m2);
lolunit_assert_equal(8, b[1].m1);
lolunit_assert_equal(9, b[1].m2);
lolunit_assert_equal(6, b[1].m3);
lolunit_assert_equal(9.f, b[1].m2);

b.Insert(1, 4, 5, 3);
b.Insert(1, 4, 5.f, "anyone home?");
lolunit_assert_equal(5, b[0].m1);
lolunit_assert_equal(6, b[0].m2);
lolunit_assert_equal(7, b[0].m3);
lolunit_assert_equal(4, b[2].m1);
lolunit_assert_equal(5, b[2].m2);
lolunit_assert_equal(3, b[2].m3);
lolunit_assert_equal(6.f, b[0].m2);
lolunit_assert_equal(4, b[1].m1);
lolunit_assert_equal(5.f, b[1].m2);
lolunit_assert_equal(8, b[2].m1);
lolunit_assert_equal(9, b[2].m2);
lolunit_assert_equal(6, b[2].m3);
*/
lolunit_assert_equal(9.f, b[2].m2);
}

lolunit_declare_test(ArrayConcat)


Загрузка…
Отмена
Сохранить