Om
front_pull_form_operation.cpp
Go to the documentation of this file.
1 
15 #ifndef Om_Language_Operation_FrontPullFormOperation_
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(FrontPullFormOperationTest)
34 
35  BOOST_AUTO_TEST_CASE(DefinitionTest) {
36  BOOST_CHECK_EQUAL(
37  "{<-[forms]}",
38  System::Get().Evaluate("drop find {<-[forms]} system")
39  );
40  }
41 
42  BOOST_AUTO_TEST_CASE(GeneralTest) {
43  BOOST_CHECK_EQUAL(
44  "{1{2}{3}}{4{5}{6}}",
45  System::Get().Evaluate("<-[forms] {1{2}{3}4{5}{6}}")
46  );
47 
48  BOOST_CHECK_EQUAL(
49  "{1}{2}",
50  System::Get().Evaluate("<-[forms] {1 2}")
51  );
52 
53  BOOST_CHECK_EQUAL(
54  "{}{}",
55  System::Get().Evaluate("<-[forms] {}")
56  );
57 
58  BOOST_CHECK_EQUAL(
59  "{only}{}",
60  System::Get().Evaluate("<-[forms] {only}")
61  );
62 
63  BOOST_CHECK_EQUAL(
64  "<-[forms]",
65  System::Get().Evaluate("<-[forms]")
66  );
67 
68  BOOST_CHECK_EQUAL(
69  "{a{b}{c}}{}",
70  System::Get().Evaluate("<-[forms]{a{b}{c}}")
71  );
72  }
73 
74  BOOST_AUTO_TEST_SUITE_END()
75 
76  }
77 
78  }
79 
80 }
81 
82  #endif
83 
84 #else
85 
88 
89 // MARK: - Om::Language::Operation::FrontPullFormOperation
90 
91  #define Type_ \
92  Om::Language::Operation::FrontPullFormOperation
93 
94 // MARK: public (static)
95 
96 inline char const * Type_::GetName() {
98 }
99 
100 inline void Type_::Give(Evaluation & theEvaluation) {
101  theEvaluation.TakeOperation(
102  std::auto_ptr<IncompleteOperation>(
103  new PullOperation<
104  Expression,
105  FrontPullFormOperation
106  >
107  )
108  );
109 }
110 
111 template <typename TheConsumer>
112 inline void Type_::Pull(
113  Expression & theExpression,
114  TheConsumer & theConsumer
115 ) {
116  theExpression.FrontGiveForm(theConsumer);
117 }
118 
119  #undef Type_
120 
121 #endif
static System & Get()
Om header file.
#define Om_Language_Operation_FrontPullFormOperation_GetName_()
The Om library.
Definition: code_point.hpp:26
std::auto_ptr< TheGiveable > Give(TheGiveable &)
Calls Move on the object.
Om header file.