memgraph/tests/unit/concurrent_list.cpp
Kruno Tomola Fabro 5a42e15c4a Alpha version of label indexes.
Squashed messages from 9 commits:

9.
Properties now uses PropertyFamily and contained classes.
Fetching,seting,clearing properties can be done with PropertyFamilyKey or PropertyTypeKey.
Hierarchy of newly added clases is:
Vertices -n-> PropertyFamily {name: String} <-1-n-> PropertyType {type: Property::Flags}
Edges -n-> PropertyFamily {name: String} <-1-n-> PropertyType {type: Property::Flags}

PropertyFamilyKey -> PropertyType
PropertyTypeKey -> PropertyType

PropertyType t0,t1;
let t0!=t1 be true
let t0.family==t1.family be true

then next is true
PropertyTypeKey{&t0}!=PropertyTypeKey{&t1}
PropertyFamilyKey{&t0}==PropertyFamilyKey{&t1}
PropertyFamilyKey{&t0}==PropertyTypeKey{&t1}
PropertyTypeKey{&t0}==PropertyFamilyKey{&t1}

8.
Intermedate commit.
Noticed that integration queries throw SEGFAULT.

7.
Defined interface for indexes.
Fixed three memory leaks.
Fixed integration_queries test which now passes.

6.
Commit which return Xorshift128plus to valid shape.

5.
Tmp commit.

4.
Label Index is compiling.

3.
tmp

2.
Vertex::Accessor now updates Label index.

1.
Applied changes for code review.
2016-08-18 15:34:36 +01:00

76 lines
1.2 KiB
C++

#define CATCH_CONFIG_MAIN
#include "catch.hpp"
#include "data_structures/concurrent/concurrent_list.hpp"
TEST_CASE("Conncurent List insert")
{
List<int> list;
auto it = list.begin();
it.push(32);
it.reset();
REQUIRE(*it == 32);
}
TEST_CASE("Conncurent List iterate")
{
List<int> list;
auto it = list.begin();
it.push(32);
it.push(7);
it.push(9);
it.push(0);
it.reset();
REQUIRE(*it == 0);
it++;
REQUIRE(*it == 9);
it++;
REQUIRE(*it == 7);
it++;
REQUIRE(*it == 32);
it++;
REQUIRE(it == list.end());
}
TEST_CASE("Conncurent List head remove")
{
List<int> list;
auto it = list.begin();
it.push(32);
it.reset();
REQUIRE(it.remove());
REQUIRE(it.is_removed());
REQUIRE(!it.remove());
it.reset();
REQUIRE(it == list.end());
}
TEST_CASE("Conncurent List remove")
{
List<int> list;
auto it = list.begin();
it.push(32);
it.push(7);
it.push(9);
it.push(0);
it.reset();
it++;
it++;
REQUIRE(it.remove());
REQUIRE(it.is_removed());
REQUIRE(!it.remove());
it.reset();
REQUIRE(*it == 0);
it++;
REQUIRE(*it == 9);
it++;
REQUIRE(*it == 32);
it++;
REQUIRE(it == list.end());
}