Skip to content

Commit

Permalink
Refactored examples
Browse files Browse the repository at this point in the history
  • Loading branch information
Tomaqa committed Aug 18, 2024
1 parent 297cf27 commit ce8ba63
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 15 deletions.
4 changes: 3 additions & 1 deletion examples/test1.cc
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
#include <opensmt/opensmt2.h>
#include <stdio.h>

using namespace opensmt;

int main()
{
Logic logic{opensmt::Logic_t::QF_UF}; // UF Logic
Logic logic{Logic_t::QF_UF}; // UF Logic
SMTConfig c;
MainSolver mainSolver(logic, c, "test solver");
PTRef v = logic.mkBoolVar("a");
Expand Down
4 changes: 3 additions & 1 deletion examples/test2.cc
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
#include <opensmt/opensmt2.h>
#include <stdio.h>

using namespace opensmt;

int main()
{
Logic logic{opensmt::Logic_t::QF_UF}; // UF Logic
Logic logic{Logic_t::QF_UF}; // UF Logic
SMTConfig c;
MainSolver mainSolver(logic, c, "test solver");

Expand Down
6 changes: 3 additions & 3 deletions examples/test_arrays.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

#include <opensmt/opensmt2.h>

using namespace opensmt;

void usingWrapper();
void creatingComponentsDirectly();

Expand Down Expand Up @@ -54,7 +56,7 @@ void usingWrapper() {
}

void creatingComponentsDirectly() {
ArithLogic logic{opensmt::Logic_t::QF_ALIA};
ArithLogic logic{Logic_t::QF_ALIA};
SMTConfig config;
MainSolver mainSolver(logic, config, "ALIA solver");

Expand All @@ -79,5 +81,3 @@ void creatingComponentsDirectly() {
else
printf("error\n");
}


8 changes: 5 additions & 3 deletions examples/test_itp.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#include <opensmt/opensmt2.h>
#include <stdio.h>

using namespace opensmt;

Opensmt*
pre()
{
Expand All @@ -13,12 +15,12 @@ pre()

int main()
{

Opensmt* osmt = pre();
SMTConfig& c = osmt->getConfig();
MainSolver& mainSolver = osmt->getMainSolver();
Logic& logic = osmt->getLogic();

// Let's build two assertions

// First assertion (a /\ b)
Expand Down Expand Up @@ -64,7 +66,7 @@ int main()
// It can be converted to OpenSMT's representation via
ipartitions_t mask = 0;
for(unsigned i = 0; i < part.size(); ++i)
opensmt::setbit(mask, part[i] + 1);
setbit(mask, part[i] + 1);

std::vector<PTRef> itps;
itp_context->getSingleInterpolant(itps, mask);
Expand Down
6 changes: 3 additions & 3 deletions examples/test_lia.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
#include <opensmt/opensmt2.h>
#include <stdio.h>

using namespace opensmt;

void usingWrapper();
void creatingComponentsDirectly();

Expand Down Expand Up @@ -50,7 +52,7 @@ void usingWrapper() {
}

void creatingComponentsDirectly() {
ArithLogic logic{opensmt::Logic_t::QF_LIA};
ArithLogic logic{Logic_t::QF_LIA};
SMTConfig config;
MainSolver mainSolver(logic, config, "LIA solver");

Expand All @@ -76,5 +78,3 @@ void creatingComponentsDirectly() {
else
printf("error\n");
}


2 changes: 2 additions & 0 deletions examples/test_lra.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#include <opensmt/opensmt2.h>
#include <stdio.h>

using namespace opensmt;

Opensmt*
pre()
{
Expand Down
8 changes: 5 additions & 3 deletions examples/test_lra_itp.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#include <opensmt/opensmt2.h>
#include <stdio.h>

using namespace opensmt;

Opensmt*
pre()
{
Expand All @@ -13,14 +15,14 @@ pre()

int main()
{

Opensmt* osmt = pre();
SMTConfig& c = osmt->getConfig();
MainSolver& mainSolver = osmt->getMainSolver();
auto & logic = osmt->getLRALogic();

// Let's build two assertions

// Create vars
PTRef x1 = logic.mkRealVar("x1");
PTRef x2 = logic.mkRealVar("x2");
Expand Down Expand Up @@ -72,7 +74,7 @@ int main()
// It can be converted to OpenSMT's representation via
ipartitions_t mask = 0;
for(unsigned i = 0; i < part.size(); ++i)
opensmt::setbit(mask, part[i] + 1);
setbit(mask, part[i] + 1);

std::vector<PTRef> itps;
itp_context->getSingleInterpolant(itps, mask);
Expand Down
4 changes: 3 additions & 1 deletion examples/test_lra_value.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#include <opensmt/opensmt2.h>
#include <stdio.h>

using namespace opensmt;

Opensmt*
pre()
{
Expand Down Expand Up @@ -105,7 +107,7 @@ int main()
ipartitions_t mask = 0;

for(unsigned i = 0; i < part.size(); ++i)
opensmt::setbit(mask, part[i] + 1);
setbit(mask, part[i] + 1);

std::vector<PTRef> itps;
itp_context->getSingleInterpolant(itps, mask);
Expand Down

0 comments on commit ce8ba63

Please sign in to comment.