-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #96 from czgdp1807/enum_01
Ported ``integration_tests/enum_01.py`` from LPython and add support for ``enum`` in LC to compile it
- Loading branch information
Showing
4 changed files
with
173 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#include <iostream> | ||
|
||
enum Color { | ||
RED = 1, | ||
GREEN = 2, | ||
BLUE = 3 | ||
}; | ||
|
||
void test_color_enum() { | ||
std::cout << RED << " " << GREEN << " " << BLUE << std::endl; | ||
if( RED != 1 ) { | ||
exit(2); | ||
} | ||
if( GREEN != 2 ) { | ||
exit(2); | ||
} | ||
if( BLUE != 3 ) { | ||
exit(2); | ||
} | ||
} | ||
|
||
void test_selected_color(enum Color selected_color) { | ||
enum Color color; | ||
color = selected_color; | ||
if( color != RED ) { | ||
exit(2); | ||
} | ||
std::cout << color << std::endl; | ||
} | ||
|
||
int main() { | ||
|
||
test_color_enum(); | ||
test_selected_color(RED); | ||
|
||
return 0; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters