[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] scratch/merge-cedet-tests c86be27 133/316: Move tests in c
From: |
Edward John Steere |
Subject: |
[Emacs-diffs] scratch/merge-cedet-tests c86be27 133/316: Move tests in cedet/semantic |
Date: |
Fri, 27 Jan 2017 20:03:34 +0000 (UTC) |
branch: scratch/merge-cedet-tests
commit c86be274be628ca204a24f04cf81e9cc8749330f
Author: xscript <address@hidden>
Commit: Edward John Steere <address@hidden>
Move tests in cedet/semantic
---
.../cedet/cedet/semantic/tests/templates.cpp | 128 ++++++++++++++++++++
1 file changed, 128 insertions(+)
diff --git a/test/manual/cedet/cedet/semantic/tests/templates.cpp
b/test/manual/cedet/cedet/semantic/tests/templates.cpp
new file mode 100644
index 0000000..881c5b2
--- /dev/null
+++ b/test/manual/cedet/cedet/semantic/tests/templates.cpp
@@ -0,0 +1,128 @@
+// C++ examples and requests from Klaus Berndl
+
+// template in a unnamed namespace
+namespace
+{
+ template<typename Target, typename Source>
+ Target lexical_cast(Source arg)
+ {
+ std::stringstream interpreter;
+ Target result;
+
+ if(!(interpreter << arg) || !(interpreter >> result) ||
+ !(interpreter >> std::ws).eof())
+ throw bad_lexical_cast();
+
+ return result;
+ }
+}
+
+
+template <class T, FOO> class Vector
+{
+private:
+ static T* v;
+ int sz;
+
+public:
+ T& elem(int i) {return v[i];}
+ virtual ~Vector ();
+
+protected:
+ Vector ();
+};
+
+template <> class Vector <void*>
+{
+private:
+ void** v;
+ int sz;
+
+public:
+ Vector ();
+ virtual int func1(int i);
+ virtual int func2(int i) = 0;
+ static virtual int func3(int i) = 0;
+ void*& elem(int i) {return v[i];}
+ //...
+};
+
+// template contains namespace
+typedef vector<CzkUtilities::Action*> ActionList;
+
+// declaration of some template-types
+map<XXX, Test::YYY>** map_var;
+
+map_with_size<XXX, Test::YYY, size> map_size_var;
+typedef map_with_size<XXX, Test::YYY, size> SizedMap;
+
+map_with_10_size<XXX, Test::YYY, 10>* pMap_size10_var;
+typedef map_with_10_size<XXX, Test::YYY, 10> Size10Map;
+
+// a function which such a template-argument
+void* test_function(map<ClassX, Test::ClassY, 10>* pMap);
+
+
+template <class T> class Vector <T*> : private Vector <void*>
+{
+public:
+ typedef Vector <void*> Base;
+
+ Vector () : Base() {}
+
+ T*& elem(int i) {return static_cast<T*&>(Base::elem(i));}
+ //...
+};
+
+// outside method implementation of a template-class
+template<class T> T& Vector<T*>::elem(int i)
+{
+ return C;
+}
+
+// same but qualified with a namespace Testnamespace
+template<class T> T& Testnamespace::Vector<T*>::elem(int i)
+{
+ return C;
+}
+
+// function templates with keyword typename
+template<typename Target, typename Source>
+Target lexical_cast(Source arg)
+{
+ std::stringstream interpreter;
+ Target result;
+
+ if(!(interpreter << arg) || !(interpreter >> result) ||
+ !(interpreter >> std::ws).eof())
+ throw bad_lexical_cast();
+
+ return result;
+}
+
+template<class T>
+static
+typename T::_ptr_type
+getService(const std::string& pServiceName, const int pRetries=20)
+{
+ return T::_narrow(getServiceObject(pServiceName, pRetries));
+}
+
+// function template declaration
+template<class T> void sort(vector<T>&);
+// complex function template definition
+template<class T, class S, const NamespaceY::ClassX<TestClass, &s> volatile
***&i>
+map<ClassY, ClassX, 10>
+sort(const vector<T>& v)
+{
+ return;
+}
+
+// variable declarations of template-types
+foo<TClass, Testnamespace::XClass, i> *bar1;
+foo<TClass, Testnamespace::XClass, **&i> *bar2;
+foo<TClass, Testnamespace::XClass, *Namespace::ClassX::i> bar3;
+foo<0> bar0;
+
+class SomeName;
+class OtherName;
- [Emacs-diffs] scratch/merge-cedet-tests e4db2c3 187/316: Disable auto add, do shared-library-only test, (continued)
- [Emacs-diffs] scratch/merge-cedet-tests e4db2c3 187/316: Disable auto add, do shared-library-only test, Edward John Steere, 2017/01/27
- [Emacs-diffs] scratch/merge-cedet-tests 31d40a7 257/316: Fix EIEIO methodinvoke-utest and semantic-fmt-utest., Edward John Steere, 2017/01/27
- [Emacs-diffs] scratch/merge-cedet-tests 4730d02 197/316: Refactor tests, Edward John Steere, 2017/01/27
- [Emacs-diffs] scratch/merge-cedet-tests 02f847a 288/316: New tests., Edward John Steere, 2017/01/27
- [Emacs-diffs] scratch/merge-cedet-tests e78d9b8 201/316: Fix merge error in unit tests., Edward John Steere, 2017/01/27
- [Emacs-diffs] scratch/merge-cedet-tests e7118b0 221/316: Move tests in cedet/semantic, Edward John Steere, 2017/01/27
- [Emacs-diffs] scratch/merge-cedet-tests 4bf5287 199/316: Fix interactive unit tests., Edward John Steere, 2017/01/27
- [Emacs-diffs] scratch/merge-cedet-tests c40401d 273/316: Remove obsolete cvs-auto-updated 'X-RCS' line., Edward John Steere, 2017/01/27
- [Emacs-diffs] scratch/merge-cedet-tests 8cb6670 304/316: Fake ver_linux for project detection purposes., Edward John Steere, 2017/01/27
- [Emacs-diffs] scratch/merge-cedet-tests d3a0e00 219/316: Erorr when appropriate, Edward John Steere, 2017/01/27
- [Emacs-diffs] scratch/merge-cedet-tests c86be27 133/316: Move tests in cedet/semantic,
Edward John Steere <=
- [Emacs-diffs] scratch/merge-cedet-tests 02c7dbb 310/316: Move tests in cedet/semantic, Edward John Steere, 2017/01/27
- [Emacs-diffs] scratch/merge-cedet-tests cebc72c 228/316: Make unit tests use randomized file names, Edward John Steere, 2017/01/27
- [Emacs-diffs] scratch/merge-cedet-tests 47d9c79 295/316: Moved tests about, Edward John Steere, 2017/01/27
- [Emacs-diffs] scratch/merge-cedet-tests f8e3bbc 311/316: Return fully qualified types if necessary., Edward John Steere, 2017/01/27
- [Emacs-diffs] scratch/merge-cedet-tests 19646a7 141/316: semantic/bovine/c: Add support for typedef references, Edward John Steere, 2017/01/27
- [Emacs-diffs] scratch/merge-cedet-tests 39f1464 235/316: (cit-srecode-fill-cpp): Fixed misspelling of target name., Edward John Steere, 2017/01/27
- [Emacs-diffs] scratch/merge-cedet-tests fb048d1 006/316: (semantic-c): Hack for Emacs 21 to get things running., Edward John Steere, 2017/01/27
- [Emacs-diffs] scratch/merge-cedet-tests c43f15e 015/316: Test project configuration file., Edward John Steere, 2017/01/27
- [Emacs-diffs] scratch/merge-cedet-tests 23862f3 023/316: Test friends, Edward John Steere, 2017/01/27
- [Emacs-diffs] scratch/merge-cedet-tests cdcc2c4 037/316: (Lisp_LISP): Add cit-dist.el, Edward John Steere, 2017/01/27