Om
expression_front_push_operation.cpp
Go to the documentation of this file.
1 
15 #ifndef Om_Language_Operation_ExpressionFrontPushOperation_
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(ExpressionFrontPushOperationTest)
34 
35  BOOST_AUTO_TEST_CASE(DefinitionTest) {
36  BOOST_CHECK_EQUAL(
37  "{->[expression]}",
38  System::Get().Evaluate("drop find {->[expression]} system")
39  );
40  }
41 
42  BOOST_AUTO_TEST_CASE(GeneralTest) {
43  BOOST_CHECK_EQUAL(
44  (
45  "{"
46  "1{2}\n"
47  "3\n"
48  "4{5}\n"
49  "6"
50  "}"
51  ),
52  System::Get().Evaluate("->[expression] {1{2}3}{4{5}6}")
53  );
54 
55  BOOST_CHECK_EQUAL(
56  (
57  "{"
58  "1{2}{5}\n"
59  "6"
60  "}"
61  ),
62  System::Get().Evaluate("->[expression] {1{2}}{{5}6}")
63  );
64 
65  BOOST_CHECK_EQUAL(
66  (
67  "{"
68  "{5}\n"
69  "6"
70  "}"
71  ),
72  System::Get().Evaluate("->[expression] {}{{5}6}")
73  );
74 
75  BOOST_CHECK_EQUAL(
76  (
77  "{"
78  "{5}\n"
79  "6"
80  "}"
81  ),
82  System::Get().Evaluate("->[expression] {{5}6}{}")
83  );
84 
85  BOOST_CHECK_EQUAL(
86  (
87  "{"
88  "{2}\n"
89  "3"
90  "}"
91  ),
92  System::Get().Evaluate("->[expression] quote{2}{3}")
93  );
94 
95  BOOST_CHECK_EQUAL(
96  "{2{3}}",
97  System::Get().Evaluate("->[expression]{2}quote{3}")
98  );
99  }
100 
101  BOOST_AUTO_TEST_SUITE_END()
102 
103  }
104 
105  }
106 
107 }
108 
109  #endif
110 
111 #else
112 
113  #include "om/language/expression.hpp"
115 
116 // MARK: - Om::Language::Operation::ExpressionFrontPushOperation
117 
118  #define Type_ \
119  Om::Language::Operation::ExpressionFrontPushOperation
120 
121 // MARK: public (static)
122 
123 inline char const * Type_::GetName() {
125 }
126 
127 inline void Type_::Give(Evaluation & theEvaluation) {
128  theEvaluation.TakeOperation(
129  std::auto_ptr<IncompleteOperation>(
130  new FrontPushOperation<
131  Expression,
132  ExpressionFrontPushOperation
133  >
134  )
135  );
136 }
137 
138  #undef Type_
139 
140 #endif
static System & Get()
Om header file.
#define Om_Language_Operation_ExpressionFrontPushOperation_GetName_()
The Om library.
Definition: code_point.hpp:26
std::auto_ptr< TheGiveable > Give(TheGiveable &)
Calls Move on the object.