Carl Shapiro | 1fb8620 | 2011-06-27 17:43:13 -0700 | [diff] [blame] | 1 | // Copyright 2011 Google Inc. All Rights Reserved. |
| 2 | |
Brian Carlstrom | 578bbdc | 2011-07-21 14:07:47 -0700 | [diff] [blame^] | 3 | #include "class_linker.h" |
| 4 | #include "common_test.h" |
| 5 | #include "dex_file.h" |
| 6 | #include "heap.h" |
| 7 | #include "object.h" |
| 8 | #include "scoped_ptr.h" |
Carl Shapiro | 1fb8620 | 2011-06-27 17:43:13 -0700 | [diff] [blame] | 9 | |
| 10 | #include <stdio.h> |
| 11 | #include "gtest/gtest.h" |
| 12 | |
| 13 | namespace art { |
| 14 | |
Brian Carlstrom | 578bbdc | 2011-07-21 14:07:47 -0700 | [diff] [blame^] | 15 | class DexFileTest : public RuntimeTest {}; |
| 16 | |
| 17 | TEST_F(DexFileTest, Open) { |
| 18 | |
| 19 | DexFile* dex_file = down_cast<DexFile*>(class_linker_->AllocObjectArray(DexFile::kMax)); |
| 20 | ASSERT_TRUE(dex_file != NULL); |
| 21 | dex_file->Init(class_linker_->AllocObjectArray(1), |
| 22 | class_linker_->AllocObjectArray(2), |
| 23 | class_linker_->AllocObjectArray(3), |
| 24 | class_linker_->AllocObjectArray(4)); |
| 25 | EXPECT_EQ(1U, dex_file->NumStrings()); |
| 26 | EXPECT_EQ(2U, dex_file->NumClasses()); |
| 27 | EXPECT_EQ(3U, dex_file->NumMethods()); |
| 28 | EXPECT_EQ(4U, dex_file->NumFields()); |
Carl Shapiro | 1fb8620 | 2011-06-27 17:43:13 -0700 | [diff] [blame] | 29 | } |
| 30 | |
Carl Shapiro | 1fb8620 | 2011-06-27 17:43:13 -0700 | [diff] [blame] | 31 | } // namespace art |