Brian Carlstrom | 7e49dca | 2011-07-22 18:07:34 -0700 | [diff] [blame] | 1 | // Copyright 2011 Google Inc. All Rights Reserved. |
| 2 | |
| 3 | #include "class_linker.h" |
| 4 | #include "common_test.h" |
| 5 | #include "dex_cache.h" |
| 6 | #include "heap.h" |
| 7 | #include "object.h" |
| 8 | #include "scoped_ptr.h" |
| 9 | |
| 10 | #include <stdio.h> |
| 11 | #include "gtest/gtest.h" |
| 12 | |
| 13 | namespace art { |
| 14 | |
| 15 | class DexCacheTest : public RuntimeTest {}; |
| 16 | |
| 17 | TEST_F(DexCacheTest, Open) { |
| 18 | |
Brian Carlstrom | 4a96b60 | 2011-07-26 16:40:23 -0700 | [diff] [blame] | 19 | DexCache* dex_cache = class_linker_->AllocDexCache(); |
Brian Carlstrom | 7e49dca | 2011-07-22 18:07:34 -0700 | [diff] [blame] | 20 | ASSERT_TRUE(dex_cache != NULL); |
Brian Carlstrom | 4a96b60 | 2011-07-26 16:40:23 -0700 | [diff] [blame] | 21 | dex_cache->Init(class_linker_->AllocObjectArray<String>(1), |
| 22 | class_linker_->AllocObjectArray<Class>(2), |
| 23 | class_linker_->AllocObjectArray<Method>(3), |
| 24 | class_linker_->AllocObjectArray<Field>(4)); |
Brian Carlstrom | 7e49dca | 2011-07-22 18:07:34 -0700 | [diff] [blame] | 25 | EXPECT_EQ(1U, dex_cache->NumStrings()); |
| 26 | EXPECT_EQ(2U, dex_cache->NumClasses()); |
| 27 | EXPECT_EQ(3U, dex_cache->NumMethods()); |
| 28 | EXPECT_EQ(4U, dex_cache->NumFields()); |
| 29 | } |
| 30 | |
| 31 | } // namespace art |