Skip to content

Commit

Permalink
Test that set comprehensions work
Browse files Browse the repository at this point in the history
Related to #42
  • Loading branch information
peterwvj committed Oct 25, 2016
1 parent cb659be commit d67c1fe
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 0 deletions.
Expand Up @@ -79,6 +79,14 @@ public void ExpressionQuote() throws IOException, InterruptedException,
generate(getPath("expressions/ExpressionQuote.vdmrt"));
compileAndTest(getTestCppFile("quote/ExpressionQuote_Tests.cpp"));
}

@Test
public void ExpressionComprehensions() throws IOException, InterruptedException,
CMakeGenerateException
{
generate(getPath("expressions/ExpressionComprehensions.vdmrt"));
compileAndTest(getTestCppFile("comprehensions/ExpressionComprehensions_Tests.cpp"));
}

@Test
public void SubclassResponsibility() throws IOException, InterruptedException,
Expand Down
@@ -0,0 +1,21 @@

#include "gtest/gtest.h"

extern "C" {
#include "Vdm.h"
#include <stdio.h>
#include "ExpressionComprehensions.h"

}

#define CHECK(methodId) TVP c=_Z24ExpressionComprehensionsEV(NULL);\
TVP res=CALL_FUNC( ExpressionComprehensions, ExpressionComprehensions,c,methodId);\
EXPECT_EQ (true,res->value.boolVal);\
vdmFree(res);\
vdmFree(c)

TEST(ExpressionComprehensions, retSetComp)
{
CHECK(CLASS_ExpressionComprehensions__Z10retSetCompEV);
}

@@ -0,0 +1,8 @@
class ExpressionComprehensions

functions

public retSetComp : () -> bool
retSetComp () == {x | x in set {1,2,3} & x > 0} = {1,2,3};

end ExpressionComprehensions

0 comments on commit d67c1fe

Please sign in to comment.