forked from lcompilers/lpython
-
Notifications
You must be signed in to change notification settings - Fork 0
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 lcompilers#60 from lcompilers/assert
Test `assert` with a message
- Loading branch information
Showing
5 changed files
with
7 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
def test_assert(): | ||
a: i32 | ||
a = 5 | ||
assert a == 5 | ||
assert a == 5, 'a is not 5' | ||
assert a != 10 |
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 |
---|---|---|
@@ -1 +1 @@ | ||
(TranslationUnit (SymbolTable 1 {test_assert: (Subroutine (SymbolTable 2 {a: (Variable 2 a Local () () Default (Integer 4 []) Source Public Required .false.)}) test_assert [] [(= (Var 2 a) (ConstantInteger 5 (Integer 4 [])) ()) (Assert (Compare (Var 2 a) Eq (ConstantInteger 5 (Integer 4 [])) (Logical 4 []) () ()) ()) (Assert (Compare (Var 2 a) NotEq (ConstantInteger 10 (Integer 4 [])) (Logical 4 []) () ()) ())] Source Public Implementation () .false. .false.)}) []) | ||
(TranslationUnit (SymbolTable 1 {test_assert: (Subroutine (SymbolTable 2 {a: (Variable 2 a Local () () Default (Integer 4 []) Source Public Required .false.)}) test_assert [] [(= (Var 2 a) (ConstantInteger 5 (Integer 4 [])) ()) (Assert (Compare (Var 2 a) Eq (ConstantInteger 5 (Integer 4 [])) (Logical 4 []) () ()) (ConstantString "a is not 5" (Character 1 10 () []))) (Assert (Compare (Var 2 a) NotEq (ConstantInteger 10 (Integer 4 [])) (Logical 4 []) () ()) ())] Source Public Implementation () .false. .false.)}) []) |
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 |
---|---|---|
@@ -1 +1 @@ | ||
(Module [(FunctionDef test_assert ([] [] [] [] [] [] []) [(AnnAssign (Name a Store) (Name i32 Load) () 1) (Assign [(Name a Store)] (ConstantInt 5 ()) ()) (Assert (Compare (Name a Load) Eq [(ConstantInt 5 ())]) ()) (Assert (Compare (Name a Load) NotEq [(ConstantInt 10 ())]) ())] [] () ())] []) | ||
(Module [(FunctionDef test_assert ([] [] [] [] [] [] []) [(AnnAssign (Name a Store) (Name i32 Load) () 1) (Assign [(Name a Store)] (ConstantInt 5 ()) ()) (Assert (Compare (Name a Load) Eq [(ConstantInt 5 ())]) (ConstantStr "a is not 5" ())) (Assert (Compare (Name a Load) NotEq [(ConstantInt 10 ())]) ())] [] () ())] []) |