Commit bda75cf0 authored by Bednárek David RNDr. Ph.D.'s avatar Bednárek David RNDr. Ph.D.
Browse files

asgn 3 (declaration) tests reworked

parent c0e1fbae
......@@ -36,13 +36,21 @@ MAKE_TEST("2" "testsxa-typedef")
MAKE_TEST("3" "test1")
MAKE_TEST("3" "test2typedef")
MAKE_TEST("3" "testdecl-arr")
MAKE_TEST("3" "testdecl-constptr")
MAKE_TEST("3" "testdecl-elementary")
MAKE_TEST("3" "testdecl-enum")
MAKE_TEST("3" "testdecl-function")
MAKE_TEST("3" "testdecl-funptr")
MAKE_TEST("3" "testdecl-local")
MAKE_TEST("3" "testdecl-pointer")
MAKE_TEST("3" "testdecl-struct")
MAKE_TEST("3" "testdecl-typedef")
#MAKE_TEST("4" "test1")
#MAKE_TEST("4" "test2typedef")
MAKE_TEST("4" "test1")
MAKE_TEST("4" "test2typedef")
MAKE_TEST("4" "testexpr-struct")
#MAKE_TEST("5" "test1")
#MAKE_TEST("5" "test2typedef")
......
// const pointer declarations
const int* const cpci;
const int(* const cpci2);
const int* const* const cpcpci;
int* const cpi;
int(* const cpi2);
int** const cppi;
const int* pci;
const int(*pci2);
int* const* pcpi;
const int** ppci;
========== tables ==========
// --- GLOBAL TYPEDEFS ---
typedef struct _file_s_0 FILE_0;
// --- FUNCTION DECLARATIONS ---
void*memset_0(void*,int,int);
int printf_0(const char*,...);
int scanf_0(const char*,...);
int sprintf_0(char*,const char*,...);
int sscanf_0(const char*,const char*,...);
// --- GLOBAL VARIABLES ---
const int*const cpci_3;
const int*const cpci2_4;
const int*const*const cpcpci_5;
int*const cpi_6;
int*const cpi2_7;
int**const cppi_8;
const int*pci_9;
const int*pci2_10;
int*const*pcpi_11;
const int**ppci_12;
// --- FUNCTION DEFINITIONS ---
========== cecko3 done ==========
// elementary types
_Bool vb;
int vi;
FILE* vpF;
void* vpv;
char* vpx;
========== tables ==========
// --- GLOBAL TYPEDEFS ---
typedef struct _file_s_0 FILE_0;
// --- FUNCTION DECLARATIONS ---
void*memset_0(void*,int,int);
int printf_0(const char*,...);
int scanf_0(const char*,...);
int sprintf_0(char*,const char*,...);
int sscanf_0(const char*,const char*,...);
// --- GLOBAL VARIABLES ---
_Bool vb_3;
int vi_4;
struct _file_s_0*vpF_5;
void*vpv_6;
char*vpx_7;
// --- FUNCTION DEFINITIONS ---
========== cecko3 done ==========
// function declarations
int fi(void);
int fixix(char, int, char);
void fv(void);
void fvi(int);
void fvix(int, char);
void fvxi(char, int);
char fxixi(int, char, int);
int fi(void)
{
return 0;
}
int fixix(char a, int b, char c)
{
return 0;
}
void fv(void)
{
}
void fvi(int d)
{
}
void fvix(int e, char f)
{
}
void fvxi(char g, int h)
{
}
char fxixi(int j, char k, int l)
{
return 0;
}
========== tables ==========
// --- GLOBAL TYPEDEFS ---
typedef struct _file_s_0 FILE_0;
// --- FUNCTION DECLARATIONS ---
int fi_3();
int fixix_4(char,int,char);
void fv_5();
void fvi_6(int);
void fvix_7(int,char);
void fvxi_8(char,int);
char fxixi_9(int,char,int);
void*memset_0(void*,int,int);
int printf_0(const char*,...);
int scanf_0(const char*,...);
int sprintf_0(char*,const char*,...);
int sscanf_0(const char*,const char*,...);
// --- GLOBAL VARIABLES ---
// --- FUNCTION DEFINITIONS ---
int fi_3(void){
}
int fixix_4(char a_15,int b_15,char c_15){
}
void fv_5(void){
}
void fvi_6(int d_22){
}
void fvix_7(int e_25,char f_25){
}
void fvxi_8(char g_28,int h_28){
}
char fxixi_9(int j_31,char k_31,int l_31){
}
========== cecko3 done ==========
// function and pointer declarations
int fipfxixi(char(*)(int, char), int);
int fipx(char*);
int (*fpfiixxi(char, int))(int, char);
char* (*fpfpxpfxpi(int*))(char(*)(void));
int* fpix(char);
int(*pfix)(char);
int(*pfix2)(char m);
char* (*(*pfpfpxi)(void))(int);
char* (*(*pfpfpxi2)(void))(int n);
char* (*pfpxpfx)(char(*)(void));
char* (*pfpxpfx2)(char(*o)(void));
int fipfxixi(char(*a)(int b, char c), int d)
{
return 0;
}
int fipx(char* e)
{
return 0;
}
int (*fpfiixxi(char f, int g))(int h, char i)
{
return 0;
}
char* (*fpfpxpfxpi(int* j))(char(*k)(void))
{
return 0;
}
int* fpix(char l)
{
return 0;
}
========== tables ==========
// --- GLOBAL TYPEDEFS ---
typedef struct _file_s_0 FILE_0;
// --- FUNCTION DECLARATIONS ---
int fipfxixi_3(char(*)(int,char),int);
int fipx_4(char*);
int(*fpfiixxi_5(char,int))(int,char);
char*(*fpfpxpfxpi_6(int*))(char(*)());
int*fpix_7(char);
void*memset_0(void*,int,int);
int printf_0(const char*,...);
int scanf_0(const char*,...);
int sprintf_0(char*,const char*,...);
int sscanf_0(const char*,const char*,...);
// --- GLOBAL VARIABLES ---
int(*pfix_9)(char);
int(*pfix2_10)(char);
char*(*(*pfpfpxi_11)())(int);
char*(*(*pfpfpxi2_12)())(int);
char*(*pfpxpfx_13)(char(*)());
char*(*pfpxpfx2_14)(char(*)());
// --- FUNCTION DEFINITIONS ---
int fipfxixi_3(char(*a_16)(int,char),int d_16){
}
int fipx_4(char*e_20){
}
int(*fpfiixxi_5(char f_24,int g_24))(int,char){
}
char*(*fpfpxpfxpi_6(int*j_28))(char(*)()){
}
int*fpix_7(char l_32){
}
========== cecko3 done ==========
// testing local variables
int v;
int main(int argc, char** argv)
{
int v;
{
int v;
{
int v;
}
}
{
int v;
}
return 0;
}
========== tables ==========
// --- GLOBAL TYPEDEFS ---
typedef struct _file_s_0 FILE_0;
// --- FUNCTION DECLARATIONS ---
int main_5(int,char**);
void*memset_0(void*,int,int);
int printf_0(const char*,...);
int scanf_0(const char*,...);
int sprintf_0(char*,const char*,...);
int sscanf_0(const char*,const char*,...);
// --- GLOBAL VARIABLES ---
int v_3;
// --- FUNCTION DEFINITIONS ---
int main_5(int argc_5,char**argv_5){
int v_7;
{
int v_9;
{
int v_11;
}
}
{
int v_15;
}
}
========== cecko3 done ==========
// pointer declarations
int* pi;
int(*pi2);
int*(pi3);
int** ppi;
int*(* ppi2);
int(** ppi3);
int(*(* ppi4));
========== tables ==========
// --- GLOBAL TYPEDEFS ---
typedef struct _file_s_0 FILE_0;
// --- FUNCTION DECLARATIONS ---
void*memset_0(void*,int,int);
int printf_0(const char*,...);
int scanf_0(const char*,...);
int sprintf_0(char*,const char*,...);
int sscanf_0(const char*,const char*,...);
// --- GLOBAL VARIABLES ---
int*pi_3;
int*pi2_4;
int*pi3_5;
int**ppi_6;
int**ppi2_7;
int**ppi3_8;
int**ppi4_9;
// --- FUNCTION DEFINITIONS ---
========== cecko3 done ==========
// testing TYPEIDF and typedef
// testing typedef
//#include <stdio.h>
typedef int ti;
typedef char tx;
typedef enum En ent;
ti vi;
tx vx;
typedef struct Str* str_ptr;
int main(int argc, char** argv)
ti main(ti argc, tx** argv)
{
FILE * myout; // this is a declaration
str_ptr p;
ent* e;
return 0;
typedef ti t2;
t2 v2;
}
typedef tx t2;
t2 v2;
========== tables ==========
// --- GLOBAL TYPEDEFS ---
typedef struct _file_s_0 FILE_0;
typedef enum En_0 ent_5;
typedef struct Str_0*str_ptr_7;
typedef char t2_15;
typedef int ti_3;
typedef char tx_4;
// --- FUNCTION DECLARATIONS ---
int main_9(int,char**);
void*memset_0(void*,int,int);
......@@ -11,10 +12,12 @@ int scanf_0(const char*,...);
int sprintf_0(char*,const char*,...);
int sscanf_0(const char*,const char*,...);
// --- GLOBAL VARIABLES ---
char v2_16;
int vi_6;
char vx_7;
// --- FUNCTION DEFINITIONS ---
int main_9(int argc_9,char**argv_9){
enum En_0*e_13;
struct _file_s_0*myout_11;
struct Str_0*p_12;
typedef int t2_11;
int v2_12;
}
========== cecko3 done ==========
// struct
struct mighty_str {
char c;
int x,y;
};
struct mighty_str F(void)
{
struct mighty_str locvar;
locvar.c = 'C';
locvar.x = 10;
locvar.y = 42;
return locvar;
}
int main(int argc, char** argv)
{
struct mighty_str ms;
ms = F();
printf("c=%c x=%d y=%d\n", ms.c, ms.x, ms.y);
char c;
int x, y;
c = F().c;
x = F().x;
y = F().y;
printf("c=%c x=%d y=%d\n", c, x, y);
return 0;
}
========== tables ==========
// --- GLOBAL TYPEDEFS ---
struct mighty_str_3{
char c_4;
int x_5;
int y_5;
};
typedef struct _file_s_0 FILE_0;
// --- FUNCTION DECLARATIONS ---
struct mighty_str_3 F_8();
int main_17(int,char**);
void*memset_0(void*,int,int);
int printf_0(const char*,...);
int scanf_0(const char*,...);
int sprintf_0(char*,const char*,...);
int sscanf_0(const char*,const char*,...);
// --- GLOBAL VARIABLES ---
// --- FUNCTION DEFINITIONS ---
struct mighty_str_3 F_8(void){
struct mighty_str_3 locvar_10;
}
int main_17(int argc_17,char**argv_17){
char c_25;
struct mighty_str_3 ms_19;
int x_26;
int y_26;
}
========== starting main() ==========
c=C x=10 y=42
c=C x=10 y=42
========== main() returned 0 ==========
========== cecko4 done ==========
Supports Markdown
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