001: /*
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005: *
006: * The contents of this file are subject to the terms of either the GNU
007: * General Public License Version 2 only ("GPL") or the Common
008: * Development and Distribution License("CDDL") (collectively, the
009: * "License"). You may not use this file except in compliance with the
010: * License. You can obtain a copy of the License at
011: * http://www.netbeans.org/cddl-gplv2.html
012: * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013: * specific language governing permissions and limitations under the
014: * License. When distributing the software, include this License Header
015: * Notice in each file and include the License file at
016: * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
017: * particular file as subject to the "Classpath" exception as provided
018: * by Sun in the GPL Version 2 section of the License file that
019: * accompanied this code. If applicable, add the following below the
020: * License Header, with the fields enclosed by brackets [] replaced by
021: * your own identifying information:
022: * "Portions Copyrighted [year] [name of copyright owner]"
023: *
024: * Contributor(s):
025: *
026: * The Original Software is NetBeans. The Initial Developer of the Original
027: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
028: * Microsystems, Inc. All Rights Reserved.
029: *
030: * If you wish your version of this file to be governed by only the CDDL
031: * or only the GPL Version 2, indicate your decision by adding
032: * "[Contributor] elects to include this software in this distribution
033: * under the [CDDL or GPL Version 2] license." If you do not indicate a
034: * single choice of license, a recipient has the option to distribute
035: * your version of this file under either the CDDL, the GPL Version 2 or
036: * to extend the choice of license to its licensees as provided above.
037: * However, if you add GPL Version 2 code and therefore, elected the GPL
038: * Version 2 license, then the option applies only if the new code is
039: * made subject to such option by the copyright holder.
040: */
041:
042: package org.netbeans.modules.cnd.modelimpl.trace;
043:
044: /**
045: * pre-integration tests for parser
046: * @author Vladimir Voskresensky
047: */
048: public class FileModelTest extends TraceModelTestBase {
049:
050: public FileModelTest(String testName) {
051: super (testName);
052: }
053:
054: @Override
055: protected void setUp() throws Exception {
056: System.setProperty("parser.report.errors", "true");
057: super .setUp();
058: }
059:
060: @Override
061: protected void postSetUp() {
062: // init flags needed for file model tests
063: getTraceModel().setDumpModel(true);
064: getTraceModel().setDumpPPState(true);
065: }
066:
067: public void testIncludeMacroExpansion() throws Exception {
068: // IZ#124635
069: performTest("include_macro_expanding.cc");
070: }
071:
072: public void testParserRecover() throws Exception {
073: performTest("parser_recover.cc");
074: }
075:
076: public void testBitFields() throws Exception {
077: performTest("bitFields.cc");
078: }
079:
080: public void testFunWithoutRetTypeInClassBody() throws Exception {
081: performTest("constructors_and_fun_no_ret_types.cc");
082: }
083:
084: public void testStackOverflowOnCastExpression() throws Exception {
085: // IZ#115549 StackOverflowError on parsing long expressions
086: performTest("stackoverflow.cc");
087: }
088:
089: public void testIncompleteString() throws Exception {
090: performTest("incomplete_string.cc");
091: }
092:
093: public void testPreProcDefinedKeyword() throws Exception {
094: performTest("preproc_defined_keyword.cc");
095: }
096:
097: public void testFriendsDeclaration() throws Exception {
098: performTest("friend.cc"); // NOI18N
099: }
100:
101: public void testCNavigation() throws Exception {
102: performTest("cnav.c"); // NOI18N
103: }
104:
105: public void testDummy() throws Exception {
106: performTest("dummy.cc"); // NOI18N
107: }
108:
109: public void testDefineMacro() throws Exception {
110: performTest("define_macro.cc"); // NOI18N
111: }
112:
113: public void testIncludeCorrectness() throws Exception {
114: performTest("test_include_correcteness.cc"); // NOI18N
115: }
116:
117: public void testTemplateExplicitInstantiation() throws Exception {
118: performTest("template_explicit_instantiation.cc"); // NOI18N
119: }
120:
121: public void testIntStaticField() throws Exception {
122: performTest("int_static_field.cc"); // NOI18N
123: }
124:
125: public void testResolverInfiniteLoop1() throws Exception {
126: performTest("infinite1.cc"); // NOI18N
127: }
128:
129: public void testResolverInfiniteLoop2() throws Exception {
130: performTest("infinite2.cc"); // NOI18N
131: }
132:
133: public void testResolverInfiniteLoop3() throws Exception {
134: performTest("infinite3.cc"); // NOI18N
135: }
136:
137: public void testCdeclAndPointerReturnType() throws Exception {
138: performTest("cdecl_and_poniter_return_type.cc"); // NOI18N
139: }
140:
141: public void testNestedClassesAndEnums_1() throws Exception {
142: performTest("nested_classes_and_enums_1.cc"); // NOI18N
143: }
144:
145: public void testFunctionPointerAsParameterType() throws Exception {
146: performTest("function_pointer_as_param_type.cc"); // NOI18N
147: }
148:
149: public void testFunctionPointerAsVariableType() throws Exception {
150: performTest("function_pointer_as_var_type.cc"); // NOI18N
151: }
152:
153: public void testFunctionPointerMisc() throws Exception {
154: performTest("function_pointer_misc.cc"); // NOI18N
155: }
156:
157: public void testUsingExtern() throws Exception {
158: performTest("using_extern.h");
159: }
160:
161: public void testPartialSpeciazationsAndOperatorLess()
162: throws Exception {
163: performTest("partial_specializations.cc");
164: }
165:
166: public void testFuncDeclPrefixAttributes() throws Exception {
167: performTest("func_decl_prefix_attributes.cc");
168: }
169:
170: public void testVariableDefinition() throws Exception {
171: performTest("variable_definition.cc"); // NOI18N
172: }
173:
174: public void testFunctionPointerAsReturnType() throws Exception {
175: performTest("function_pointer_as_return_type.cc"); // NOI18N
176: }
177:
178: public void testFunctionPointerAsTypeCast() throws Exception {
179: performTest("function_pointer_as_type_cast.cc"); // NOI18N
180: }
181:
182: public void testFunExpandedUnnamedParams() throws Exception {
183: performTest("function_expanded_unnamed_params.cc"); // NOI18N
184: }
185:
186: public void testErrorDirective() throws Exception {
187: performTest("error_directive.cc"); // NOI18N
188: }
189:
190: public void testEmptyLongHex() throws Exception {
191: performTest("empty_long_hex.c"); // NOI18N
192: }
193:
194: public void testUnresolvedPersistence() throws Exception {
195: performTest("unresolved_persistence.cc"); // NOI18N
196: }
197:
198: public void test0x01() throws Exception {
199: performTest("0x01.c"); // NOI18N
200: }
201:
202: // disable this test because it's OS-locale dependent and can fail where
203: // russian is not installed
204: // public void test0x16() throws Exception {
205: // performTest("0x16.cc"); // NOI18N
206: // }
207:
208: public void testPreProcExpressionAndEmptyBodyMacro()
209: throws Exception {
210: performTest("ppExpressionAndEmptyBodyMacro.cc"); //NOI18N
211: }
212:
213: public void testExprAfterIf() throws Exception {
214: performTest("lparenAfterPPKwds.cc"); // NOI18N
215: }
216:
217: public void testNamespaceAttribute() throws Exception {
218: performTest("namespace_attrib.cc"); // NOI18N
219: }
220:
221: public void testTypedefEnumInClassScope() throws Exception {
222: performTest("typedef_enum_in_class_scope.cc"); // NOI18N
223: }
224:
225: public void testNamedMemberEnumTypedef() throws Exception {
226: performTest("named_member_enum_typedef.cc"); // NOI18N
227: }
228:
229: public void testTypedefInsideFunc() throws Exception {
230: performTest("typedef_inside_func.cc"); // NOI18N
231: }
232:
233: public void testAttributesAlignedClass() throws Exception {
234: performTest("attributes_aligned_class.cc"); // NOI18N
235: }
236:
237: public void testStaticStruct() throws Exception {
238: performTest("static_struct.cc"); // NOI18N
239: }
240:
241: public void testInlineDtorDefinitionName() throws Exception {
242: performTest("inline_dtor_definition_name.cc"); // NOI18N
243: }
244:
245: public void testThrowConst() throws Exception {
246: performTest("throw_const.cc"); // NOI18N
247: }
248:
249: public void testTemplateDtorDefinition() throws Exception {
250: performTest("template_dtor_definition.cc"); // NOI18N
251: }
252:
253: public void testKAndRParams() throws Exception {
254: performTest("k_and_r_params.c"); // NOI18N
255: }
256:
257: public void testFunctionsAndVariables() throws Exception {
258: performTest("functions_and_variables.cc"); // NOI18N
259: }
260:
261: public void testStaticFunction() throws Exception {
262: performTest("static_function.cc"); // NOI18N
263: }
264:
265: /////////////////////////////////////////////////////////////////////
266: // FAILS
267:
268: public static class Failed extends TraceModelTestBase {
269:
270: public Failed(String testName) {
271: super (testName);
272: }
273:
274: @Override
275: protected void setUp() throws Exception {
276: System.setProperty("parser.report.errors", "true");
277: super .setUp();
278: }
279:
280: @Override
281: protected Class getTestCaseDataClass() {
282: return FileModelTest.class;
283: }
284:
285: public void testTemplateInnerClassDtorDefinition()
286: throws Exception {
287: performTest("template_inner_class_dtor_definition.cc"); // NOI18N
288: }
289:
290: @Override
291: protected void postSetUp() {
292: // init flags needed for file model tests
293: getTraceModel().setDumpModel(true);
294: getTraceModel().setDumpPPState(true);
295: }
296: }
297:
298: }
|