Skip to content

Commit

Permalink
Merge pull request #81 from czgdp1807/struct_04
Browse files Browse the repository at this point in the history
Ported ``integration_tests/derived_types_22.f90`` from LFortran
  • Loading branch information
czgdp1807 authored Feb 1, 2024
2 parents 560a111 + c934d80 commit 1ba29d4
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 0 deletions.
1 change: 1 addition & 0 deletions integration_tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -210,5 +210,6 @@ RUN(NAME array_23.cpp LABELS gcc llvm NOFAST)
RUN(NAME struct_01.cpp LABELS gcc llvm NOFAST)
RUN(NAME struct_02.cpp LABELS gcc llvm NOFAST)
RUN(NAME struct_03.cpp LABELS gcc llvm NOFAST)
RUN(NAME struct_04.cpp LABELS gcc llvm NOFAST)

RUN(NAME function_01.cpp LABELS gcc llvm NOFAST)
18 changes: 18 additions & 0 deletions integration_tests/struct_04.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#include <iostream>
#include "struct_04_m_01.h"

void pass() {
std::cout << struct_instance_sample.A << struct_instance_sample.B << std::endl;
if (abs(struct_instance_sample.A - 10.0) > 1.0e-7) {
exit(2);
}
if (abs(struct_instance_sample.B - 20.0) > 1.0e-7) {
exit(2);
}
}

int main() {
struct_instance_sample.A = 10.0;
struct_instance_sample.B = 20.0;
pass();
}
10 changes: 10 additions & 0 deletions integration_tests/struct_04_m_01.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#ifndef INTEGRATION_TESTS_STRUCT_04_M_01_H
#define INTEGRATION_TESTS_STRUCT_04_M_01_H

struct sample {
float A, B, E;
};

struct sample struct_instance_sample;

#endif

0 comments on commit 1ba29d4

Please sign in to comment.