2007-08-01 Michael Snyder <msnyder@access-company.com>
[binutils.git] / gold / testsuite / object_unittest.cc
blobc15237d822bd0923cc33da9f7faedc8969f0f4ca
1 // object_unittest.cc -- test Object, Relobj, etc.
3 #include "gold.h"
5 #include "object.h"
7 #include "test.h"
8 #include "testfile.h"
10 namespace gold_testsuite
13 using namespace gold;
15 // Test basic Object functionality.
17 bool
18 Object_test(Test_report*)
20 Input_file input_file("test.o", test_file_1, test_file_1_size);
21 Object* object = make_elf_object("test.o", &input_file, 0,
22 test_file_1, test_file_1_size);
23 CHECK(object->name() == "test.o");
24 CHECK(!object->is_dynamic());
25 CHECK(object->target() == target_test_pointer);
26 CHECK(object->is_locked());
27 object->unlock();
28 CHECK(!object->is_locked());
29 object->lock();
30 CHECK(object->shnum() == 5);
31 CHECK(object->section_name(0).empty());
32 CHECK(object->section_name(1) == ".test");
33 CHECK(object->section_flags(0) == 0);
34 CHECK(object->section_flags(1) == elfcpp::SHF_ALLOC);
35 object->unlock();
36 return true;
39 Register_test object_register("Object", Object_test);
41 } // End namespace gold_testsuite.