diff options
Diffstat (limited to 'vespalib/src/tests/alignedmemory')
-rw-r--r-- | vespalib/src/tests/alignedmemory/.cvsignore | 3 | ||||
-rw-r--r-- | vespalib/src/tests/alignedmemory/.gitignore | 4 | ||||
-rw-r--r-- | vespalib/src/tests/alignedmemory/CMakeLists.txt | 8 | ||||
-rw-r--r-- | vespalib/src/tests/alignedmemory/DESC | 1 | ||||
-rw-r--r-- | vespalib/src/tests/alignedmemory/FILES | 1 | ||||
-rw-r--r-- | vespalib/src/tests/alignedmemory/alignedmemory_test.cpp | 68 |
6 files changed, 0 insertions, 85 deletions
diff --git a/vespalib/src/tests/alignedmemory/.cvsignore b/vespalib/src/tests/alignedmemory/.cvsignore deleted file mode 100644 index 0cc06a2789a..00000000000 --- a/vespalib/src/tests/alignedmemory/.cvsignore +++ /dev/null @@ -1,3 +0,0 @@ -.depend -Makefile -alignedmemory_test diff --git a/vespalib/src/tests/alignedmemory/.gitignore b/vespalib/src/tests/alignedmemory/.gitignore deleted file mode 100644 index 8777f6e4632..00000000000 --- a/vespalib/src/tests/alignedmemory/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -.depend -Makefile -alignedmemory_test -vespalib_alignedmemory_test_app diff --git a/vespalib/src/tests/alignedmemory/CMakeLists.txt b/vespalib/src/tests/alignedmemory/CMakeLists.txt deleted file mode 100644 index 332e941f935..00000000000 --- a/vespalib/src/tests/alignedmemory/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -# Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -vespa_add_executable(vespalib_alignedmemory_test_app TEST - SOURCES - alignedmemory_test.cpp - DEPENDS - vespalib -) -vespa_add_test(NAME vespalib_alignedmemory_test_app COMMAND vespalib_alignedmemory_test_app) diff --git a/vespalib/src/tests/alignedmemory/DESC b/vespalib/src/tests/alignedmemory/DESC deleted file mode 100644 index 4f3b4f32604..00000000000 --- a/vespalib/src/tests/alignedmemory/DESC +++ /dev/null @@ -1 +0,0 @@ -alignedmemory test. Take a look at alignedmemory.cpp for details. diff --git a/vespalib/src/tests/alignedmemory/FILES b/vespalib/src/tests/alignedmemory/FILES deleted file mode 100644 index d0363c78367..00000000000 --- a/vespalib/src/tests/alignedmemory/FILES +++ /dev/null @@ -1 +0,0 @@ -alignedmemory.cpp diff --git a/vespalib/src/tests/alignedmemory/alignedmemory_test.cpp b/vespalib/src/tests/alignedmemory/alignedmemory_test.cpp deleted file mode 100644 index d53e8f212c0..00000000000 --- a/vespalib/src/tests/alignedmemory/alignedmemory_test.cpp +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/log/log.h> -LOG_SETUP("alignedmemory_test"); -#include <vespa/vespalib/testkit/testapp.h> -#include <vespa/vespalib/util/alignedmemory.h> - -using namespace vespalib; - -TEST_SETUP(Test); - -int -Test::Main() -{ - TEST_INIT("alignedmemory_test"); - { // aligned alloc - AlignedMemory mem8(32, 8); - AlignedMemory mem16(32, 16); - AlignedMemory mem512(32, 512); - AlignedMemory mem7(32, 7); - - EXPECT_EQUAL(0u, ((uintptr_t)mem8.get()) % 8); - EXPECT_EQUAL(0u, ((uintptr_t)mem16.get()) % 16); - EXPECT_EQUAL(0u, ((uintptr_t)mem512.get()) % 512); - EXPECT_EQUAL(0u, ((uintptr_t)mem7.get()) % 7); - } - { // swap - AlignedMemory a(32, 8); - AlignedMemory b(32, 8); - char *pa = a.get(); - char *pb = b.get(); - - EXPECT_EQUAL(pa, a.get()); - EXPECT_EQUAL(pb, b.get()); - a.swap(b); - EXPECT_EQUAL(pb, a.get()); - EXPECT_EQUAL(pa, b.get()); - b.swap(a); - EXPECT_EQUAL(pa, a.get()); - EXPECT_EQUAL(pb, b.get()); - } - { // std::swap - AlignedMemory a(32, 8); - AlignedMemory b(32, 8); - char *pa = a.get(); - char *pb = b.get(); - - EXPECT_EQUAL(pa, a.get()); - EXPECT_EQUAL(pb, b.get()); - std::swap(a, b); - EXPECT_EQUAL(pb, a.get()); - EXPECT_EQUAL(pa, b.get()); - std::swap(a, b); - EXPECT_EQUAL(pa, a.get()); - EXPECT_EQUAL(pb, b.get()); - } - { // construct with zero size - AlignedMemory null(0, 0); - char *expect = 0; - EXPECT_EQUAL(expect, null.get()); - } - { // const get() - const AlignedMemory null(0, 0); - const char *expect = 0; - const char *got = null.get(); - EXPECT_EQUAL(expect, got); - } - TEST_DONE(); -} |