• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /barrelfish-2018-10-04/lib/acpica/tests/aslts/src/runtime/collections/functional/control/
1/*
2 * Some or all of this work - Copyright (c) 2006 - 2016, Intel Corp.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without modification,
6 * are permitted provided that the following conditions are met:
7 *
8 * Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer.
10 * Redistributions in binary form must reproduce the above copyright notice,
11 * this list of conditions and the following disclaimer in the documentation
12 * and/or other materials provided with the distribution.
13 * Neither the name of Intel Corporation nor the names of its contributors
14 * may be used to endorse or promote products derived from this software
15 * without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
21 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
25 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
26 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29/*
30 * Method execution control
31 *
32 * Simple checkings for {if,elseif,else} operators
33 * One level {if,elseif,else}
34 */
35
36Name(z003, 3)
37
38Method(m070, 1)
39{
40	Store(0x12345678, Local0)
41
42	if (LEqual(arg0, 0)) {
43		Store(0, Local0)
44	}
45
46	return (Local0)
47}
48
49Method(m071, 1)
50{
51	Store(0x12345678, Local0)
52
53	if (LEqual(arg0, 0)) {
54		Store(0, Local0)
55	} else {
56		Store(1, Local0)
57	}
58
59	return (Local0)
60}
61
62Method(m072, 1)
63{
64	Store(0x12345678, Local0)
65
66	if (LEqual(arg0, 0)) {
67		Store(0, Local0)
68	} elseif (LEqual(arg0, 1)) {
69		Store(1, Local0)
70	}
71
72	return (Local0)
73}
74
75Method(m073, 1)
76{
77	Store(0x12345678, Local0)
78
79	if (LEqual(arg0, 0)) {
80		Store(0, Local0)
81	} elseif (LEqual(arg0, 1)) {
82		Store(1, Local0)
83	} else {
84		Store(2, Local0)
85	}
86
87	return (Local0)
88}
89
90// Run verify methods
91// NOTE: use here as few control operators as possible
92Method(m074,, Serialized)
93{
94	Name(ts, "m074")
95
96	Store("TEST: m074, One level {if, elseif, else}", Debug)
97
98	// m070
99
100	Store(0, Local7)
101	Store(m070(Local7), Local0)
102	if (LNotEqual(Local0, Local7)){
103		err(ts, z003, 0, 0, 0, Local7, 0)
104	}
105
106	Store(0x12345678, Local7)
107	Store(m070(Local7), Local0)
108	if (LNotEqual(Local0, Local7)){
109		err(ts, z003, 1, 0, 0, Local7, 0)
110	}
111
112	// m071
113
114	Store(0, Local7)
115	While(LLess(Local7, 2)) {
116		Store(m071(Local7), Local0)
117		if (LNotEqual(Local0, Local7)){
118			err(ts, z003, 2, 0, 0, Local7, 0)
119		}
120		Increment(Local7)
121	}
122
123	Store(0x12345678, Local7)
124	Store(m071(Local7), Local0)
125	if (LNotEqual(Local0, 1)){
126		err(ts, z003, 3, 0, 0, Local7, 0)
127	}
128
129	// m072
130
131	Store(0, Local7)
132	While(LLess(Local7, 2)) {
133		Store(m072(Local7), Local0)
134		if (LNotEqual(Local0, Local7)){
135			err(ts, z003, 4, 0, 0, Local7, 0)
136		}
137		Increment(Local7)
138	}
139
140	Store(0x12345678, Local7)
141	Store(m072(Local7), Local0)
142	if (LNotEqual(Local0, Local7)){
143		err(ts, z003, 5, 0, 0, Local7, 0)
144	}
145
146	// m073
147
148	Store(0, Local7)
149	While(LLess(Local7, 3)) {
150		Store(m073(Local7), Local0)
151		if (LNotEqual(Local0, Local7)){
152			err(ts, z003, 6, 0, 0, Local7, 0)
153		}
154		Increment(Local7)
155	}
156
157	Store(0x12345678, Local7)
158	Store(m073(Local7), Local0)
159	if (LNotEqual(Local0, 2)){
160		err(ts, z003, 7, 0, 0, Local7, 0)
161	}
162}
163
164// Run-method
165Method(CTL0)
166{
167	Store("TEST: CTL0, Conditional execution", Debug)
168
169	m074()
170}
171
172