Skip to content

Commit 473223d

Browse files
committed
add missing files, make tests work
1 parent b4cf423 commit 473223d

File tree

4 files changed

+42
-14
lines changed

4 files changed

+42
-14
lines changed

test/cpp/schema_specific/CMakeLists.txt

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,25 @@ INCLUDE_DIRECTORIES( ${SCL_SOURCE_DIR}/src/cldai ${SCL_SOURCE_DIR}/src/cleditor
1010
FUNCTION( add_schema_dependent_test name sdai_lib args )
1111
add_executable( tst_${name} "${name}.cc" )
1212
set_target_properties( tst_${name} PROPERTIES COMPILE_FLAGS "-I${CMAKE_BINARY_DIR}/${sdai_lib}" )
13-
set_target_properties( tst_${name} PROPERTIES EXCLUDE_FROM_ALL ON )
1413
target_link_libraries( tst_${name} sdai_${sdai_lib} )
1514
add_test( NAME test_${name}
1615
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
17-
COMMAND tst_${name} ${args} )
18-
set_tests_properties( test_${name} PROPERTIES DEPENDS build_cpp_sdai_${sdai_lib} LABELS cpp_schema_specific )
16+
COMMAND $<TARGET_FILE:tst_${name}> ${args} )
17+
set_tests_properties( test_${name} PROPERTIES DEPENDS build_cpp_sdai_${sdai_lib}
18+
DEPENDS tst_${name}
19+
LABELS cpp_schema_specific )
1920
ENDFUNCTION( add_schema_dependent_test name sdai_lib args )
2021

22+
SET(SCL_ENABLE_TESTING OFF)
2123
BUILD_A_SCHEMA( ${SCL_SOURCE_DIR}/test/unitary_schemas/array_bounds_expr.exp )
24+
SET(SCL_ENABLE_TESTING ON)
25+
2226
add_schema_dependent_test( "aggregate_bound_runtime" "array_bounds_expr"
2327
"${SCL_SOURCE_DIR}/test/p21/test_array_bounds.p21" )
2428

2529
add_test( NAME test_aggregate_bound_runtime_FAIL1
2630
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
27-
COMMAND tst_aggregate_bound_runtime "${SCL_SOURCE_DIR}/test/p21/test_array_bounds_FAIL1.p21" )
31+
COMMAND $<TARGET_FILE:tst_aggregate_bound_runtime> "${SCL_SOURCE_DIR}/test/p21/test_array_bounds_FAIL1.p21" )
2832
set_tests_properties( test_aggregate_bound_runtime_FAIL1 PROPERTIES
29-
DEPENDS test_aggregate_bound_runtime WILL_FAIL true LABELS cpp )
33+
DEPENDS test_aggregate_bound_runtime WILL_FAIL true
34+
LABELS cpp_schema_specific )

test/cpp/schema_specific/aggregate_bound_runtime.cc

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ int main( int argc, char * argv[] ) {
2828
Severity readSev = sfile.Error().severity();
2929
if( readSev != SEVERITY_NULL ) {
3030
sfile.Error().PrintContents(cout);
31-
abort();
31+
exit(EXIT_FAILURE);
3232
}
3333

3434
// Keeps track of the last processed ent id
@@ -45,7 +45,7 @@ int main( int argc, char * argv[] ) {
4545
const AggrTypeDescriptor* atd = (const AggrTypeDescriptor*) attrDesc->DomainType();
4646
if( !( atd->Bound1Type() == bound_constant ) || !( atd->Bound2Type() == bound_runtime ) ) {
4747
cerr << "Invalid bounds. Exiting." << endl;
48-
abort();
48+
exit(EXIT_FAILURE);
4949
}
5050
cout << " -- bound 1 is a constant (" << atd->Bound1() << "). bound 2 depends upon the instance." << endl;
5151
descAggrCount++;
@@ -54,7 +54,7 @@ int main( int argc, char * argv[] ) {
5454
}
5555
if( descAggrCount != 1 ) {
5656
cerr << "Expected 1 aggregate attribute descriptor, found " << descAggrCount <<". Exiting." << endl;
57-
abort();
57+
exit(EXIT_FAILURE);
5858
}
5959

6060

@@ -72,11 +72,11 @@ int main( int argc, char * argv[] ) {
7272
cout << "Ent #" << id << " - ";
7373
if( cnt != 3 ) {
7474
cerr << "Expected 3 attributes, found " << cnt << ". Exiting." << endl;
75-
abort();
75+
exit(EXIT_FAILURE);
7676
}
7777
if( id > 2 ) {
7878
cerr << "Expected 2 instances, found " << cnt << ". Exiting." << endl;
79-
abort();
79+
exit(EXIT_FAILURE);
8080
}
8181
//loop over the attributes
8282
for( int i = 0; i < cnt; i++ ) {
@@ -87,7 +87,7 @@ int main( int argc, char * argv[] ) {
8787
if( ( ( id == 1 ) && ( b2 != 3 ) ) || ( ( id == 2 ) && ( b2 != 5 ) ) ) {
8888
cerr << "Instance " << id << ": value " << b2 << " is invalid for bound 2.";
8989
cerr << " Expecting 3 for instance #1 or 5 for #2." << endl;
90-
abort();
90+
exit(EXIT_FAILURE);
9191
}
9292
}
9393
}
@@ -98,12 +98,12 @@ int main( int argc, char * argv[] ) {
9898
while( aggrNode != 0 ) {
9999
if( node >= b2 ) {
100100
cerr << "Instance " << id << ": Number of values exceeds upper bound. Exiting." << endl;
101-
abort();
101+
exit(EXIT_FAILURE);
102102
}
103103
cout << aggrNode->value << " ";
104104
if( aggrValues[id-1][node] != aggrNode->value ) {
105105
cerr << "Instance " << id << ": aggregate value " << aggrNode->value << " at index " << node << " is incorrect. Exiting." << endl;
106-
abort();
106+
exit(EXIT_FAILURE);
107107
}
108108
aggrNode = (IntNode*) aggrNode->NextNode();
109109
node++;
@@ -112,7 +112,7 @@ int main( int argc, char * argv[] ) {
112112

113113
if( instAggrCnt != 1 ) {
114114
cerr << "Expected 1 aggregate attribute in this instance, found " << instAggrCnt << ". Exiting." << endl;
115-
abort();
115+
exit(EXIT_FAILURE);
116116
}
117117

118118

test/p21/test_array_bounds.p21

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
ISO-10303-21;
2+
HEADER;
3+
FILE_DESCRIPTION(('SCL test file'),'2;1');
4+
FILE_NAME('test_array_bounds.p21','2012-03-31T',('mp'),(''),'0','1','2');
5+
FILE_SCHEMA(('test_array_bounds_expr'));
6+
ENDSEC;
7+
DATA;
8+
#1=STRUCTURED_MESH('one',3,(1,2,3));
9+
#2=STRUCTURED_MESH('two',5,(9,34,0,3,999999));
10+
ENDSEC;
11+
END-ISO-10303-21;
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
ISO-10303-21;
2+
HEADER;
3+
FILE_DESCRIPTION(('SCL test file'),'2;1');
4+
FILE_NAME('test_array_bounds_FAIL1.p21','2012-03-31T',('mp'),(''),'0','1','2');
5+
FILE_SCHEMA(('test_array_bounds_expr'));
6+
ENDSEC;
7+
DATA;
8+
/* attr 2 in inst 1 is wrong */
9+
#1=STRUCTURED_MESH('one',2,(1,2,3));
10+
#2=STRUCTURED_MESH('two',5,(9,34,0,3,999999));
11+
ENDSEC;
12+
END-ISO-10303-21;

0 commit comments

Comments
 (0)