Om
rearrange_operation.cpp
Go to the documentation of this file.
1 
15 #ifndef Om_Language_Operation_RearrangeOperation_
16 
18 
19  #ifdef Om_Macro_Test_
20 
21  #ifndef Om_Macro_Precompilation_
22 
23  #include "boost/test/unit_test.hpp"
24 
25  #endif
26 
27 namespace Om {
28 
29  namespace Language {
30 
31  namespace Operation {
32 
33  BOOST_AUTO_TEST_SUITE(RearrangeOperationTest)
34 
35  BOOST_AUTO_TEST_CASE(DefinitionTest) {
36  BOOST_CHECK_EQUAL(
37  "{rearrange}",
38  System::Get().Evaluate("drop find {rearrange} system")
39  );
40  }
41 
42  BOOST_AUTO_TEST_CASE(GeneralTest) {
43  BOOST_CHECK_EQUAL(
44  "{2}{1}",
45  System::Get().Evaluate("rearrange{b a}{a b}{1}{2}")
46  );
47 
48  BOOST_CHECK_EQUAL(
49  "{2}{1}",
50  System::Get().Evaluate(
51  "rearrange"
52  "{the` flaven the` glaven}"
53  "{the` glaven the` flaven}"
54  "{1}{2}"
55  )
56  );
57 
58  BOOST_CHECK_EQUAL(
59  "{2}{1}",
60  System::Get().Evaluate(
61  "rearrange"
62  "{do{the glaven} do{the flaven}}"
63  "{the` flaven the` glaven}"
64  "{1}{2}"
65  )
66  );
67  }
68 
69  BOOST_AUTO_TEST_SUITE_END()
70 
71  }
72 
73  }
74 
75 }
76 
77  #endif
78 
79 #else
80 
89 
90 // MARK: - Om::Language::Operation::RearrangeOperation
91 
92  #define Type_ \
93  Om::Language::Operation::RearrangeOperation
94 
95 // MARK: public (static)
96 
97 inline char const * Type_::GetName() {
99 }
100 
101 inline void Type_::Give(Evaluation & theEvaluation) {
102  // define swap skip {dequote inject {quote} pair {fill}}
103  DefineOperation::Give(theEvaluation);
104  SwapOperation::Give(theEvaluation);
105  SkipOperation::Give(theEvaluation);
106  Expression theExpression;
107  theExpression.TakeOperator(
108  DequoteOperation::GetOperator()
109  );
110  theExpression.TakeOperator(
111  InjectOperation::GetOperator()
112  );
113  theExpression.TakeQuotedProducer(
114  QuoteOperation::GetOperator()
115  );
116  theExpression.TakeOperator(
117  PairOperation::GetOperator()
118  );
119  theExpression.TakeQuotedProducer(
120  FillOperation::GetOperator()
121  );
122  theEvaluation.TakeQuotedProducer(theExpression);
123 }
124 
125  #undef Type_
126 
127 #endif
static System & Get()
Om header file.
Om header file.
Om header file.
Om header file.
The Om library.
Definition: code_point.hpp:26
std::auto_ptr< TheGiveable > Give(TheGiveable &)
Calls Move on the object.
Om header file.
Om header file.
#define Om_Language_Operation_RearrangeOperation_GetName_()
Om header file.
Om header file.