Om
front_pull_operator_operation.cpp
Go to the documentation of this file.
1 
15 #ifndef Om_Language_Operation_FrontPullOperatorOperation_
16 
18 
19  #ifdef Om_Macro_Test_
20 
21  #include "om/language/system.hpp"
22 
23  #ifndef Om_Macro_Precompilation_
24 
25  #include "boost/test/unit_test.hpp"
26 
27  #endif
28 
29 namespace Om {
30 
31  namespace Language {
32 
33  namespace Operation {
34 
35  BOOST_AUTO_TEST_SUITE(FrontPullOperatorOperationTest)
36 
37  BOOST_AUTO_TEST_CASE(DefinitionTest) {
38  BOOST_CHECK_EQUAL(
39  "{<-[operator...]}",
40  System::Get().Evaluate("drop find {<-[operator...]} system")
41  );
42  }
43 
44  BOOST_AUTO_TEST_CASE(GeneralTest) {
45  BOOST_CHECK_EQUAL(
46  "{1}{{2}3}",
47  System::Get().Evaluate("<-[operator...] {1{2}3}")
48  );
49 
50  BOOST_CHECK_EQUAL(
51  "{}{{2}3}",
52  System::Get().Evaluate("<-[operator...] {{2}3}")
53  );
54 
55  BOOST_CHECK_EQUAL(
56  "{1}{ 2}",
57  System::Get().Evaluate("<-[operator...] {1 2}")
58  );
59 
60  BOOST_CHECK_EQUAL(
61  "{}{}",
62  System::Get().Evaluate("<-[operator...] {}")
63  );
64 
65  BOOST_CHECK_EQUAL(
66  "{only}{}",
67  System::Get().Evaluate("<-[operator...] {only}")
68  );
69 
70  BOOST_CHECK_EQUAL(
71  "<-[operator...]",
72  System::Get().Evaluate("<-[operator...]")
73  );
74  }
75 
76  BOOST_AUTO_TEST_SUITE_END()
77 
78  }
79 
80  }
81 
82 }
83 
84  #endif
85 
86 #else
87 
88  #include "om/language/literal.hpp"
90 
91 // MARK: - Om::Language::Operation::FrontPullOperatorOperation
92 
93  #define Type_ \
94  Om::Language::Operation::FrontPullOperatorOperation
95 
96 // MARK: public (static)
97 
98 inline char const * Type_::GetName() {
100 }
101 
102 inline void Type_::Give(Evaluation & theEvaluation) {
103  theEvaluation.TakeOperation(
104  std::auto_ptr<IncompleteOperation>(
105  new PullOperation<
106  Literal,
107  FrontPullOperatorOperation
108  >
109  )
110  );
111 }
112 
113 template <typename TheConsumer>
114 inline void Type_::Pull(
115  Literal & theLiteral,
116  TheConsumer & theConsumer
117 ) {
118  theLiteral.FrontGive<Operator>(theConsumer);
119 }
120 
121  #undef Type_
122 
123 #endif
static System & Get()
#define Om_Language_Operation_FrontPullOperatorOperation_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.
Om header file.