aRts audio server
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

testifacerepo.cc 2.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. /*
  2. Copyright (C) 2000 Stefan Westerfeld
  3. stefan@space.twc.de
  4. This library is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU Library General Public
  6. License as published by the Free Software Foundation; either
  7. version 2 of the License, or (at your option) any later version.
  8. This library is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. Library General Public License for more details.
  12. You should have received a copy of the GNU Library General Public License
  13. along with this library; see the file COPYING.LIB. If not, write to
  14. the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  15. Boston, MA 02110-1301, USA.
  16. */
  17. #include <algorithm>
  18. #include "common.h"
  19. #include "test.h"
  20. using namespace Arts;
  21. using namespace std;
  22. struct TestInterfaceRepo : public TestCase
  23. {
  24. TESTCASE(TestInterfaceRepo);
  25. Arts::Dispatcher dispatcher;
  26. Arts::InterfaceRepo interfaceRepo;
  27. void setUp() {
  28. interfaceRepo = Arts::Dispatcher::the()->interfaceRepo();
  29. }
  30. TEST(queryInterface) {
  31. InterfaceDef def = interfaceRepo.queryInterface("Arts::InterfaceRepo");
  32. testEquals("Arts::InterfaceRepo",def.name);
  33. }
  34. TEST(queryType) {
  35. TypeDef def = interfaceRepo.queryType("Arts::MethodDef");
  36. testEquals("Arts::MethodDef",def.name);
  37. }
  38. TEST(queryEnum) {
  39. EnumDef def = interfaceRepo.queryEnum("Arts::AttributeType");
  40. testEquals("Arts::AttributeType",def.name);
  41. }
  42. bool contains(vector<string>& sequence, const string& element)
  43. {
  44. vector<string>::iterator it;
  45. it = find(sequence.begin(),sequence.end(), element);
  46. return (it != sequence.end());
  47. }
  48. TEST(queryInterfaces) {
  49. vector<string> *interfaces = interfaceRepo.queryInterfaces();
  50. testAssert(contains(*interfaces,"Arts::InterfaceRepo"));
  51. testAssert(!contains(*interfaces,"Arts::MethodDef"));
  52. delete interfaces;
  53. }
  54. TEST(queryTypes) {
  55. vector<string> *types = interfaceRepo.queryTypes();
  56. testAssert(contains(*types,"Arts::MethodDef"));
  57. testAssert(!contains(*types,"Arts::AttributeType"));
  58. delete types;
  59. }
  60. TEST(queryEnums) {
  61. vector<string> *enums = interfaceRepo.queryEnums();
  62. testAssert(contains(*enums,"Arts::AttributeType"));
  63. testAssert(!contains(*enums,"Arts::InterfaceRepo"));
  64. delete enums;
  65. }
  66. };
  67. TESTMAIN(TestInterfaceRepo);