1#!/bin/bash
2#
3# Copyright (C) 2007 The Android Open Source Project
4#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9#     http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16
17# The tests that don't specify "--debug" are expected to
18# throw exceptions.  If --debug is on we'll get a stack
19# trace, which is unpredictable and doesn't work well with
20# expected.txt vs. out.txt comparisons.
21
22function check_rejected {
23  dx --dump --width=100 --strict $1
24}
25
26function check_accepted {
27  dx --debug --dump --width=100 $1
28}
29
30# Bad magic (throws an expection)
31check_rejected class-bad-magic.txt
32
33# Too small (throws an exception)
34check_rejected class-version-44.0.txt
35check_rejected class-version-44.65535.txt
36
37# Just right
38check_accepted class-version-45.0.txt
39check_accepted class-version-45.65535.txt
40check_accepted class-version-48.0.txt
41check_accepted class-version-48.65535.txt
42check_accepted class-version-49.0.txt
43check_accepted class-version-49.1.txt
44check_accepted class-version-49.65535.txt
45check_accepted class-version-50.0.txt
46check_accepted class-version-50.1.txt
47check_accepted class-version-50.65535.txt
48check_accepted class-version-51.0.txt
49check_accepted class-version-51.65535.txt
50check_accepted class-version-52.0.txt
51check_accepted class-version-52.1.txt
52check_accepted class-version-52.65535.txt
53check_accepted class-version-53.0.txt
54
55# Too big (throws an exception)
56check_rejected class-version-53.1.txt
57check_rejected class-version-53.65535.txt
58check_rejected class-version-54.0.txt
59
60# Show that we can dump the access flags even when they
61# don't make any sense.
62check_accepted small-class.txt
63