X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Funittest%2Frangemaptest.cc;h=6975f66efa799dd35df6c97ca0cbbd6936205bee;hb=6e354e82d9395b20f5f148cd545d0666b626e8ac;hp=6fd99c927bf5d76ebc3762d4b72c00ba570de191;hpb=5bdf4400b223056d296ae27f4a7ee2f707a4d1bd;p=gem5.git diff --git a/src/unittest/rangemaptest.cc b/src/unittest/rangemaptest.cc index 6fd99c927..6975f66ef 100644 --- a/src/unittest/rangemaptest.cc +++ b/src/unittest/rangemaptest.cc @@ -1,4 +1,16 @@ /* + * Copyright (c) 2012 ARM Limited + * All rights reserved + * + * The license below extends only to copyright in the software and shall + * not be construed as granting a license to any other intellectual + * property including but not limited to intellectual property relating + * to a hardware implementation of the functionality of the software + * licensed hereunder. You may use the software subject to the license + * terms below provided that you ensure that this notice is replicated + * unmodified and in its entirety in all distributions of the software, + * modified or unmodified, in source code or in binary form. + * * Copyright (c) 2006 The Regents of The University of Michigan * All rights reserved. * @@ -28,36 +40,41 @@ * Authors: Ali Saidi */ -#include #include -#include "sim/host.hh" -#include "base/range_map.hh" +#include + +#include "base/addr_range_map.hh" using namespace std; -int main() +int +main() { - range_map r; + AddrRangeMap r; - range_map::iterator i; + AddrRangeMap::const_iterator i; - i = r.insert(RangeIn(0,40),5); + i = r.insert(RangeIn(10, 40), 5); assert(i != r.end()); - i = r.insert(RangeIn(60,90),3); + i = r.insert(RangeIn(60, 90), 3); assert(i != r.end()); - i = r.find(RangeIn(20,30)); + i = r.find(RangeIn(20, 30)); assert(i != r.end()); - cout << i->first << " " << i->second << endl; + cout << i->first.to_string() << " " << i->second << endl; - i = r.find(RangeIn(55,55)); + i = r.find(RangeIn(55, 55)); assert(i == r.end()); -} - - - - + i = r.insert(RangeIn(0, 12), 1); + assert(i == r.end()); + i = r.insert(RangeIn(0, 9), 1); + assert(i != r.end()); + i = r.find(RangeIn(20, 30)); + assert(i != r.end()); + cout << i->first.to_string() << " " << i->second << endl; + return 0; +}