e7af7a4aef
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com> Co-authored-by: Erik Osterlund <erik.osterlund@oracle.com> Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com> Co-authored-by: Kim Barrett <kim.barrett@oracle.com> Co-authored-by: Nils Eliasson <nils.eliasson@oracle.com> Co-authored-by: Rickard Backman <rickard.backman@oracle.com> Co-authored-by: Roland Westrelin <rwestrel@redhat.com> Co-authored-by: Coleen Phillimore <coleen.phillimore@oracle.com> Co-authored-by: Robbin Ehn <robbin.ehn@oracle.com> Co-authored-by: Gerard Ziemski <gerard.ziemski@oracle.com> Co-authored-by: Hugh Wilkinson <hugh.wilkinson@intel.com> Co-authored-by: Sandhya Viswanathan <sandhya.viswanathan@intel.com> Co-authored-by: Bill Wheeler <bill.npo.wheeler@intel.com> Co-authored-by: Vinay K. Awasthi <vinay.k.awasthi@intel.com> Co-authored-by: Yasumasa Suenaga <yasuenag@gmail.com> Reviewed-by: pliden, stefank, eosterlund, ehelin, sjohanss, rbackman, coleenp, ihse, jgeorge, lmesnik, rkennke
31 lines
938 B
C++
31 lines
938 B
C++
/*
|
|
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
|
|
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
|
|
*/
|
|
|
|
#include "precompiled.hpp"
|
|
#include "gc/z/zVirtualMemory.inline.hpp"
|
|
#include "utilities/debug.hpp"
|
|
#include "unittest.hpp"
|
|
|
|
TEST(ZVirtualMemory, split) {
|
|
const size_t PageSize = 2 * M;
|
|
|
|
ZVirtualMemory mem(0, 10 * PageSize);
|
|
|
|
ZVirtualMemory mem_split0 = mem.split(0 * PageSize);
|
|
EXPECT_EQ(mem_split0.size(), 0 * PageSize);
|
|
EXPECT_EQ( mem.size(), 10 * PageSize);
|
|
|
|
ZVirtualMemory mem_split1 = mem.split(5u * PageSize);
|
|
EXPECT_EQ(mem_split1.size(), 5 * PageSize);
|
|
EXPECT_EQ( mem.size(), 5 * PageSize);
|
|
|
|
ZVirtualMemory mem_split2 = mem.split(5u * PageSize);
|
|
EXPECT_EQ(mem_split2.size(), 5 * PageSize);
|
|
EXPECT_EQ( mem.size(), 0 * PageSize);
|
|
|
|
ZVirtualMemory mem_split3 = mem.split(0 * PageSize);
|
|
EXPECT_EQ(mem_split3.size(), 0 * PageSize);
|
|
}
|