Commit 0a3694b7 authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files

Add test

parent 82422c02
......@@ -2,8 +2,8 @@
 
# Resource object code
#
# Created: Mon Jan 4 10:55:39 2016
# by: The Resource Compiler for PySide (Qt v4.8.6)
# Created: Sun Jan 31 20:41:12 2016
# by: The Resource Compiler for PySide (Qt v4.8.4)
#
# WARNING! All changes made in this file will be lost!
 
This diff is collapsed.
This diff is collapsed.
include ../shared.mk
all: test-ada test-llvm
edit:
$(OPENGEODE) challenge.pr system_structure.pr
test-parse:
$(OPENGEODE) challenge.pr system_structure.pr --check
test-ada: challenge.ali dataview-uniq.o | test_ada.o
$(GNATBIND) -n challenge.ali
$(GNATLINK) -o test_ada test_ada.o challenge.ali -lgnat -lm
./test_ada
test-c: challenge.c test_c.o dataview-uniq.o
$(CC) -include missing.h challenge.c -c -o challenge.o
$(CC) test_c.o challenge.c dataview-uniq.o -lm -o test_c
./test_c
test-llvm: challenge.o dataview-uniq.o | test_llvm.o
$(CC) challenge.o dataview-uniq.o test_llvm.o -o test_llvm -lm
./test_llvm
coverage:
coverage run -p $(OPENGEODE) challenge.pr system_structure.pr --toAda
.PHONY: all edit test-parse test-ada test-llvm coverage
/* CIF PROCESS (150, 150), (150, 75) */
PROCESS challenge;
STATE AGGREGATION Aggreg;
SUBSTRUCTURE
/* CIF STATE (148, 125), (70, 35) */
STATE A;
ENDSTATE;
/* CIF STATE (123, 267), (70, 35) */
STATE B;
ENDSTATE;
ENDSUBSTRUCTURE;
/* CIF TEXT (80, 0), (298, 56) */
-- This system tests nested states
dcl result T_uint32 :=0;
/* CIF ENDTEXT */
/* CIF START (89, 79), (68, 37) */
START;
/* CIF PROCEDURECALL (69, 131), (107, 35) */
CALL writeln('1');
/* CIF NEXTSTATE (88, 181), (70, 35) */
NEXTSTATE OFF;
/* CIF STATE (290, 148), (82, 35) */
STATE Aggreg;
ENDSTATE;
/* CIF STATE (88, 181), (70, 35) */
STATE OFF;
/* CIF INPUT (88, 236), (70, 35) */
INPUT run;
/* CIF PROCEDURECALL (69, 286), (107, 35) */
CALL writeln('2');
/* CIF NEXTSTATE (81, 336), (82, 35) */
NEXTSTATE Aggreg;
ENDSTATE;
ENDPROCESS challenge;
\ No newline at end of file
TASTE-BasicTypes DEFINITIONS ::=
BEGIN
-- Set of TASTE predefined basic types
T-Int32 ::= INTEGER (-2147483648 .. 2147483647)
T-UInt32 ::= INTEGER (0 .. 4294967295)
T-Int8 ::= INTEGER (-128 .. 127)
T-UInt8 ::= INTEGER (0 .. 255)
T-Boolean ::= BOOLEAN
BitString ::= BIT STRING (SIZE(32))
OctString ::= OCTET STRING (SIZE(4))
SeqBit ::= SEQUENCE (SIZE(32)) OF BOOLEAN
SeqBit2 ::= SEQUENCE (SIZE(1..32)) OF BOOLEAN
END
TASTE-Dataview DEFINITIONS ::=
BEGIN
IMPORTS T-Int32, T-UInt32, T-Int8, T-UInt8, T-Boolean FROM TASTE-BasicTypes;
-- A few simple types to start with ASN.1
challenge T-UInt32 ::= 18
bound T-UInt32 ::= 1000000
nb-bit T-UInt32 ::= 20
val-max T-UInt32 ::= 1048575
count-max T-UInt32 ::= 524288
exceed-nb T-UInt32 ::= 48575
CountTab ::= SEQUENCE (SIZE(nb-bit)) OF T-UInt32
END
/* CIF Keep Specific Geode ASNFilename 'dataview-uniq.asn' */
USE Datamodel;
SYSTEM challenge;
PROCEDURE pow COMMENT '#c_predef';
FPAR
IN a T_UInt32,
IN b T_UInt32,
OUT res T_UInt32;
EXTERNAL;
SIGNAL run;
SIGNAL go_off;
SIGNAL any_one;
signal any_two;
CHANNEL c
FROM ENV TO challenge WITH run, go_off, any_one, any_two;
ENDCHANNEL;
BLOCK challenge;
SIGNALROUTE r
FROM ENV TO challenge WITH run, go_off, any_one, any_two;
CONNECT c and r;
PROCESS challenge REFERENCED;
ENDBLOCK;
ENDSYSTEM;
#include <math.h>
#include <stdio.h>
/* Ada code external interface */
extern void challenge_run();
extern void challenge_any_one();
extern int adainit();
//extern long long l_result;
/* Provide code called by the Ada state machine as external procedure */
void challenge_RI_pow(long long *a, long long *b, long long *res)
{
*res = (long long)pow((double)*a, (double)*b);
}
int main()
{
adainit();
challenge_run();
challenge_run();
//printf("Internal state: %lld\n", l_result);
challenge_any_one();
challenge_run();
return 0;
}
#include <math.h>
#include <stdio.h>
/* Provide code called by the Ada state machine as external procedure */
void challenge_RI_pow(long long *a, long long *b, long long *res)
{
*res = (long long)pow((double)*a, (double)*b);
}
int main()
{
CInit();
runTransition(0);
run();
run();
//printf("Internal state: %lld\n", l_result);
any_one();
run();
return 0;
}
#include <math.h>
#include <stdio.h>
/* Ada code external interface */
extern void challenge_run();
extern void challenge_any_one();
extern int challenge_startup();
//extern long long l_result;
/* Provide code called by the Ada state machine as external procedure */
void challenge_RI_pow(long long *a, long long *b, long long *res)
{
*res = (long long)pow((double)*a, (double)*b);
}
int main()
{
challenge_startup();
challenge_run();
challenge_run();
//printf("Internal state: %lld\n", l_result);
challenge_any_one();
challenge_run();
return 0;
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment