]> git.eshelyaron.com Git - emacs.git/commitdiff
Move tests in cedet/semantic
authorxscript <xscript@users.sourceforge.net>
Fri, 29 Apr 2011 00:32:56 +0000 (02:32 +0200)
committerEdward John Steere <edward.steere@gmail.com>
Wed, 25 Jan 2017 15:59:25 +0000 (17:59 +0200)
test/manual/cedet/cedet/semantic/tests/teststruct.cpp [new file with mode: 0644]

diff --git a/test/manual/cedet/cedet/semantic/tests/teststruct.cpp b/test/manual/cedet/cedet/semantic/tests/teststruct.cpp
new file mode 100644 (file)
index 0000000..6bc27b9
--- /dev/null
@@ -0,0 +1,66 @@
+// Combinations of templates and structure inheritance.
+//
+// Created by Alex Ott.
+
+template <typename DerivedT>
+struct grammar {
+public:
+  typedef grammar<DerivedT> self_t;
+  typedef DerivedT const& embed_t;
+  grammar() {}
+  ~grammar() { }
+  void use_parser() const { }
+  void test1() { }
+};
+
+struct PDFbool_parser : public grammar<PDFbool_parser> {
+  PDFbool_parser() {}
+  template <typename scannerT> struct definition {
+    typedef typename scannerT::iterator_t iterator_t;
+    int top;
+    definition(const PDFbool_parser& /*self*/) {
+      return ;
+    }
+    const int start() const {
+      return top;
+    }
+  };
+};
+
+int main(void) {
+  PDFbool_parser PDFbool_p = PDFbool_parser();
+  PDFbool_p.//-1-
+    ;
+  // #1# ("definition" "embed_t" "self_t" "test1" "use_parser")
+}
+
+// ----------------------------------------------------------------------
+
+template <class Derived> struct Base {
+public:
+  void interface()
+  {
+    // ...
+    static_cast<Derived*>(this)->implementation();
+    // ...
+  }
+
+  static void static_func()
+  {
+    // ...
+    Derived::static_sub_func();
+    // ...
+  }
+};
+
+struct Derived : Base<Derived> {
+  void implementation() { }
+  static void static_sub_func() { }
+};
+
+int foo () {
+  Derived d;
+  d.//-2-
+    ;
+  // #2# ("implementation" "interface" "static_func" "static_sub_func")
+}