blob: 0ad0b3b5e0d0582c77aeeeb21816b0d5190328c8 [file] [log] [blame]
Carl Shapiro1fb86202011-06-27 17:43:13 -07001// Copyright 2011 Google Inc. All Rights Reserved.
2
Brian Carlstrom578bbdc2011-07-21 14:07:47 -07003#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 Shapiro1fb86202011-06-27 17:43:13 -07009
10#include <stdio.h>
11#include "gtest/gtest.h"
12
13namespace art {
14
Brian Carlstrom578bbdc2011-07-21 14:07:47 -070015class DexFileTest : public RuntimeTest {};
16
17TEST_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 Shapiro1fb86202011-06-27 17:43:13 -070029}
30
Carl Shapiro1fb86202011-06-27 17:43:13 -070031} // namespace art