FbxStatusTest.cs 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. // ***********************************************************************
  2. // Copyright (c) 2017 Unity Technologies. All rights reserved.
  3. //
  4. // Licensed under the ##LICENSENAME##.
  5. // See LICENSE.md file in the project root for full license information.
  6. // ***********************************************************************
  7. using NUnit.Framework;
  8. using System.Collections;
  9. using Autodesk.Fbx;
  10. namespace Autodesk.Fbx.UnitTests
  11. {
  12. public class FbxStatusTest
  13. {
  14. #if ENABLE_COVERAGE_TEST
  15. [Test]
  16. public void TestCoverage() { CoverageTester.TestCoverage(typeof(FbxStatus), this.GetType()); }
  17. #endif
  18. [Test]
  19. public void TestBasics()
  20. {
  21. // test constructor
  22. FbxStatus status = new FbxStatus ();
  23. Assert.IsNotNull (status);
  24. // test dispose
  25. status.Dispose ();
  26. using (new FbxStatus ()) {}
  27. // test comparing code and status
  28. status = new FbxStatus(FbxStatus.EStatusCode.eIndexOutOfRange);
  29. Assert.AreEqual(FbxStatus.EStatusCode.eIndexOutOfRange, status.GetCode());
  30. Assert.IsTrue(FbxStatus.EStatusCode.eIndexOutOfRange == status);
  31. Assert.IsTrue(status == FbxStatus.EStatusCode.eIndexOutOfRange);
  32. Assert.IsTrue(FbxStatus.EStatusCode.eInvalidParameter != status);
  33. Assert.IsTrue(status != FbxStatus.EStatusCode.eInvalidParameter);
  34. // test copy ctor and clear (it only modifies status2, not status)
  35. var status2 = new FbxStatus(status);
  36. status2.Clear();
  37. Assert.IsTrue(status.Error());
  38. Assert.IsFalse(status2.Error());
  39. // test SetCode
  40. status2.SetCode(FbxStatus.EStatusCode.eIndexOutOfRange);
  41. Assert.AreEqual(status, status2);
  42. status2.SetCode(FbxStatus.EStatusCode.eInvalidParameter, "wrong");
  43. Assert.AreEqual("wrong", status2.GetErrorString());
  44. // test equality
  45. EqualityTester<FbxStatus>.TestEquality(status, status2, new FbxStatus(status));
  46. }
  47. }
  48. }