PageRenderTime 34ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/indra/llinventory/tests/llparcel_test.cpp

https://bitbucket.org/lindenlab/viewer-beta/
C++ | 69 lines | 32 code | 10 blank | 27 comment | 1 complexity | 95b389eeb7bfb35bf489c571a1d3f385 MD5 | raw file
Possible License(s): LGPL-2.1
  1. /**
  2. * @file llinventoryparcel_tut.cpp
  3. * @author Moss
  4. * @date 2007-04-17
  5. *
  6. * $LicenseInfo:firstyear=2007&license=viewerlgpl$
  7. * Second Life Viewer Source Code
  8. * Copyright (C) 2010, Linden Research, Inc.
  9. *
  10. * This library is free software; you can redistribute it and/or
  11. * modify it under the terms of the GNU Lesser General Public
  12. * License as published by the Free Software Foundation;
  13. * version 2.1 of the License only.
  14. *
  15. * This library is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  18. * Lesser General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU Lesser General Public
  21. * License along with this library; if not, write to the Free Software
  22. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  23. *
  24. * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
  25. * $/LicenseInfo$
  26. */
  27. #include <string>
  28. #include "linden_common.h"
  29. #include "../llparcel.h"
  30. #include "../test/lltut.h"
  31. namespace tut
  32. {
  33. struct llinventoryparcel_data
  34. {
  35. };
  36. typedef test_group<llinventoryparcel_data> llinventoryparcel_test;
  37. typedef llinventoryparcel_test::object llinventoryparcel_object;
  38. tut::llinventoryparcel_test llinventoryparcel("LLInventoryParcel");
  39. template<> template<>
  40. void llinventoryparcel_object::test<1>()
  41. {
  42. for (S32 i=0; i<LLParcel::C_COUNT; ++i)
  43. {
  44. const std::string& catstring = LLParcel::getCategoryString(LLParcel::ECategory(i));
  45. ensure("LLParcel::getCategoryString(i)",
  46. !catstring.empty());
  47. const std::string& catuistring = LLParcel::getCategoryUIString(LLParcel::ECategory(i));
  48. ensure("LLParcel::getCategoryUIString(i)",
  49. !catuistring.empty());
  50. ensure_equals("LLParcel::ECategory mapping of string back to enum", LLParcel::getCategoryFromString(catstring), i);
  51. ensure_equals("LLParcel::ECategory mapping of uistring back to enum", LLParcel::getCategoryFromUIString(catuistring), i);
  52. }
  53. // test the C_ANY case, which has to work for UI strings
  54. const std::string& catuistring = LLParcel::getCategoryUIString(LLParcel::C_ANY);
  55. ensure("LLParcel::getCategoryUIString(C_ANY)",
  56. !catuistring.empty());
  57. ensure_equals("LLParcel::ECategory mapping of uistring back to enum", LLParcel::getCategoryFromUIString(catuistring), LLParcel::C_ANY);
  58. }
  59. }