Om
front_pull_element_operation.cpp
Go to the documentation of this file.
1 
15 #ifndef Om_Language_Operation_FrontPullElementOperation_
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(FrontPullElementOperationTest)
34 
35  BOOST_AUTO_TEST_CASE(DefinitionTest) {
36  BOOST_CHECK_EQUAL(
37  "{<-[...]}",
38  System::Get().Evaluate("drop find {<-[...]} system")
39  );
40  }
41 
42  BOOST_AUTO_TEST_CASE(GeneralTest) {
43  BOOST_CHECK_EQUAL(
44  "{1}{{2}3}",
45  System::Get().Evaluate("<-[...] {1{2}3}")
46  );
47 
48  BOOST_CHECK_EQUAL(
49  "{1}{ 2}",
50  System::Get().Evaluate("<-[...] {1 2}")
51  );
52 
53  BOOST_CHECK_EQUAL(
54  "{}{}",
55  System::Get().Evaluate("<-[...] {}")
56  );
57 
58  BOOST_CHECK_EQUAL(
59  "{only}{}",
60  System::Get().Evaluate("<-[...] {only}")
61  );
62 
63  BOOST_CHECK_EQUAL(
64  "<-[...]",
65  System::Get().Evaluate("<-[...]")
66  );
67  }
68 
69  BOOST_AUTO_TEST_SUITE_END()
70 
71  }
72 
73  }
74 
75 }
76 
77  #endif
78 
79 #else
80 
81  #include "om/language/literal.hpp"
83 
84 // MARK: - Om::Language::Operation::FrontPullElementOperation
85 
86  #define Type_ \
87  Om::Language::Operation::FrontPullElementOperation
88 
89 // MARK: public (static)
90 
91 inline char const * Type_::GetName() {
93 }
94 
95 inline void Type_::Give(Evaluation & theEvaluation) {
96  theEvaluation.TakeOperation(
97  std::auto_ptr<IncompleteOperation>(
98  new PullOperation<
99  Literal,
100  FrontPullElementOperation
101  >
102  )
103  );
104 }
105 
106 template <typename TheConsumer>
107 inline void Type_::Pull(
108  Literal & theLiteral,
109  TheConsumer & theConsumer
110 ) {
111  theLiteral.FrontGiveElement(theConsumer);
112 }
113 
114  #undef Type_
115 
116 #endif
static System & Get()
#define Om_Language_Operation_FrontPullElementOperation_GetName_()
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.