Commit a4100ebe authored by Chong Yidong's avatar Chong Yidong
Browse files

Update Semantic test copyrights, delete some test files (Bug#4656).

* cedet/tests/test.cpp:
* cedet/tests/test.py:
* cedet/tests/teststruct.cpp:
* cedet/tests/testtemplates.cpp:
* cedet/tests/testusing.cpp:
* cedet/tests/scopetest.cpp:
* cedet/tests/scopetest.java: Files deleted.

* cedet/tests/test.make:
* cedet/tests/test.c:
* cedet/tests/testjavacomp.java:
* cedet/tests/testspp.c:
* cedet/tests/testsppreplace.c:
* cedet/tests/testsppreplaced.c:
* cedet/tests/testsubclass.cpp:
* cedet/tests/testsubclass.hh:
* cedet/tests/testtypedefs.cpp:
* cedet/tests/testvarnames.c:
* cedet/tests/test.el:
* cedet/tests/testdoublens.cpp:
* cedet/tests/testdoublens.hpp: Add copyright header.

* cedet/semantic-tests.el (semanticdb-test-gnu-global): Remove
reference to deleted files.
parent fe59d705
2010-03-29 Chong Yidong <cyd@stupidchicken.com>
* cedet/tests/test.cpp:
* cedet/tests/test.py:
* cedet/tests/teststruct.cpp:
* cedet/tests/testtemplates.cpp:
* cedet/tests/testusing.cpp:
* cedet/tests/scopetest.cpp:
* cedet/tests/scopetest.java: Files deleted.
* cedet/tests/test.make:
* cedet/tests/test.c:
* cedet/tests/testjavacomp.java:
* cedet/tests/testspp.c:
* cedet/tests/testsppreplace.c:
* cedet/tests/testsppreplaced.c:
* cedet/tests/testsubclass.cpp:
* cedet/tests/testsubclass.hh:
* cedet/tests/testtypedefs.cpp:
* cedet/tests/testvarnames.c:
* cedet/tests/test.el:
* cedet/tests/testdoublens.cpp:
* cedet/tests/testdoublens.hpp: Add copyright header.
* cedet/semantic-tests.el (semanticdb-test-gnu-global): Remove
reference to deleted files.
2010-02-19 Ulf Jasper <ulf.jasper@web.de>
* icalendar-testsuite.el
......
......@@ -42,10 +42,7 @@
"tests/testdoublens.cpp"
"tests/testsubclass.cpp"
"tests/testtypedefs.cpp"
"tests/teststruct.cpp"
"tests/testtemplates.cpp"
"tests/testfriends.cpp"
"tests/testusing.cpp"
"tests/testnsp.cpp"
"tests/testsppcomplete.c"
"tests/testvarnames.c"
......
......@@ -107,53 +107,6 @@ If optional arg STANDARDFILE is non-nil, use a standard file w/ global enabled."
(data-debug-new-buffer "*SemanticDB Gnu Global Result*")
(data-debug-insert-thing result "?" ""))))
;;; From semantic-find
(require 'semantic/find)
(defun semantic-find-benchmark ()
"Run some simple benchmarks to see how we are doing.
Optional argument ARG is the number of iterations to run."
(interactive)
(require 'benchmark)
(let ((f-name nil)
(b-name nil)
(f-comp)
(b-comp)
(f-regex)
)
(garbage-collect)
(setq f-name
(benchmark-run-compiled
1000 (semantic-find-first-tag-by-name "class3"
"test/test.cpp")))
(garbage-collect)
(setq b-name
(benchmark-run-compiled
1000 (semantic-brute-find-first-tag-by-name "class3"
"test/test.cpp")))
(garbage-collect)
(setq f-comp
(benchmark-run-compiled
1000 (semantic-find-tags-for-completion "method"
"test/test.cpp")))
(garbage-collect)
(setq b-comp
(benchmark-run-compiled
1000 (semantic-brute-find-tag-by-name-regexp "^method"
"test/test.cpp")))
(garbage-collect)
(setq f-regex
(benchmark-run-compiled
1000 (semantic-find-tags-by-name-regexp "^method"
"test/test.cpp")))
(message "Name [new old] [ %.3f %.3f ] Complete [newc/new old] [ %.3f/%.3f %.3f ]"
(car f-name) (car b-name)
(car f-comp) (car f-regex)
(car b-comp))
))
;;; From semantic-format
(require 'semantic/format)
......
/* Test scoping rules for c++ in the analyzer. */
namespace {
class aclass2; // Forward reference.
class aclass1 {
private:
int attrp1;
int amethodp1(int argp1);
aclass2 areference;
protected:
int attrpr1;
public:
int attr1;
int amethod1(int arg1);
};
}
namespace {
class aclass2 : public aclass1
{
private:
int attrp2;
int amethodp2(int argp1);
public:
aclass2(int aninitvalue);
~aclass2();
int attr2;
int amethod2(int arg2);
};
}
aclass2::aclass2(init aninitvalue)
{
/* This is a comment that talks about aclass1 */
aclass1;
}
int aclass2::amethod2(int arg2)
{
int alocalvar;
float q;
ac;
}
// arch-tag: 9336063c-6b2e-4677-a390-d2dd091a2474
class Foo {
public void a1() {}
class Bar {
public int a2() {}
public void b() {
a // -1-
}
class Baz {
public int a3() {}
public Baz(int a4) {
a // -2-
}
}
}
}
\ No newline at end of file
// 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;
// arch-tag: 55ff74de-74dc-44ad-8252-50dc5f3492c3
/* Test file for C language.
* Attempt to include as many aspects of the C language as possible.
/* test.c --- Semantic unit test for C.
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
2010 Free Software Foundation, Inc.
Author: Eric M. Ludlam <eric@siege-engine.com>
This file is part of GNU Emacs.
GNU Emacs is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
GNU Emacs is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
*/
/* Attempt to include as many aspects of the C language as possible.
*/
/* types of include files */
#include "includeme1.h"
#include <includeme2.h>
......
/* Test file for C++ language.
* Attempt to include as many aspects of the C++ language as possible.
* Do not include things tested in test.c since that shares the
* same language.
*/
/* An include test */
#include <stdio.h>
#include <cmath>
#include "c++-test.hh"
#include <c++-test.hh>
double var1 = 1.2;
int simple1(int a) {
}
struct foo1 {
int test;
};
struct foo2 : public foo1 {
const int foo21(int a, int b);
const int foo22(int a, int b) { return 1 }
};
/* Classes */
class class1 {
private:
int var11;
struct foo1 var12;
public:
int p_var11;
struct foo p_var12;
};
class i_class1 : public class1 {
private:
int var11;
struct foo var12;
public:
int p_var11;
struct foo p_var12;
};
class class2 {
private:
int var21;
struct foo var22;
public:
int p_var21;
struct foo p_var22;
};
class i_class2 : public class1, public class2 {
private:
int var21;
struct foo var22;
protected:
int pt_var21;
public:
int p_var21;
struct foo p_var22;
};
class class3 {
/* A class with strange things in it */
public:
class3(); /* A constructor */
enum embedded_foo_enum {
a, b, c
} embed1;
struct embedded_bar_struct {
int a;
int b;
} embed2;
class embedded_baz_class {
embedded_baz_class();
~embedded_baz_class();
} embed3;
~class3(); /* destructor */
/* Methods */
int method_for_class3(int a, char b);
int inline_method(int c) { return c; }
/* Operators */
class3& operator^= (const class3& something);
/* Funny declmods */
const class3 * const method_const_ptr_ptr(const int * const argconst) const = 0;
};
class3::class3()
{
/* Constructor outside the definition. */
}
int class3::method_for_class3(int a, char b)
{
}
int class3::method1_for_class3( int a, int &b)
{
int cvariablename;
class3 fooy[];
class3 moose = new class3;
// Complktion testing line should find external members.
a = fooy[1].me ;
b = cv ;
if (fooy.emb) {
simple1(c);
}
cos(10);
abs(10);
return 1;
}
char class3::method2_for_class3( int a, int b) throw ( exception1 )
{
return 'a';
}
void *class3::method3_for_class3( int a, int b) throw ( exception1, exception2 )
{
int q = a;
return "Moose";
}
void *class3::method31_for_class3( int a, int b) throw ( )
{
int q = a;
return "Moose";
}
void *class3::method4_for_class3( int a, int b) reentrant
{
class3 ct;
ct.method5_for_class3(1,a);
pritf();
}
/*
* A method on class3.
*/
void *class3::method5_for_class3( int a, int b) const
{
}
/*
* Namespace parsing tests
*/
namespace NS {
class class_in_namespace {
int equiv(const NS::class_in_namespace *) const;
};
}
int NS::class_in_namespace::equiv(const NS::class_in_namespace *cin) const
{
return 0;
}
// Stuff Klaus found.
// Inheritance w/out a specifying for public.
class class4 : class1 {
// Pure virtual methods.
void virtual print () const = 0;
public:
// The whacky constructor type
class4()
try : class1(args)
{
// constructor body
}
catch ()
{
}
};
class class5 : public virtual class4 {
// Virtual inheritance
};
class class6 : class1 {
// Mutable
mutable int i;
};
/* Namespaces */
namespace namespace1 {
void ns_method1() { }
class n_class1 {
public:
void method11(int a) { }
};
/* This shouldn't parse due to missing semicolon. */
class _n_class2 : public n_class1 {
void n_c2_method1(int a, int b) { }
};
// Macros in the namespace
#define NSMACRO 1
// Template in the namespace
template<class T> T nsti1(const Foo& foo);
template<> int nsti1<int>(const Foo& foo);
}
namespace namespace2 {
using namespace1::n_class1;
}
/* Initializers */
void tinitializers1(): inita1(False),
inita2(False)
{
inita1= 1;
}
/* How about Extern C type things. */
int funny_prototype(int ,int b,float c)
{
}
extern "C"
int extern_c_1(int a, int b)
{
funny_prototype(1,2,3.4);
printf("Moose", );
return 1;
}
extern "C" {
int extern_c_2(int a, int b)
{
return 1;
}
}
// Some operator stuff
class Action
{
// Problems!! operator() and operator[] can not be parsed with semantic
// 1.4.2 but with latest c.by
virtual void operator()(int i, char *p ) = 0;
virtual String& operator[]() = 0;
virtual void operator!() = 0;
virtual void operator->() = 0;
virtual T& operator+=();
virtual T& operator*();
virtual T& operator*=();
};
// class with namespace qualified parents
class Multiinherit : public virtual POA::Parent,
public virtual POA::Parent1,
Parent
{
private:
int i;