FPRGDTEventTest.m 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. // Copyright 2020 Google LLC
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. #import <XCTest/XCTest.h>
  15. #import "FirebasePerformance/Sources/Loggers/FPRGDTEvent.h"
  16. #import "FirebasePerformance/Tests/Unit/FPRTestUtils.h"
  17. #import "FirebasePerformance/ProtoSupport/PerfMetric.pbobjc.h"
  18. @interface FPRGDTEventTest : XCTestCase
  19. @end
  20. @implementation FPRGDTEventTest
  21. /** Tests the designated initializer. */
  22. - (void)testInstanceCreation {
  23. FPRMSGPerfMetric *metric = [FPRMSGPerfMetric message];
  24. FPRGDTEvent *event = [FPRGDTEvent gdtEventForPerfMetric:metric];
  25. XCTAssertNotNil(event);
  26. }
  27. /** Validate that the instance has transportBytes for default Perf Metric. */
  28. - (void)testInstanceHasTransportBytesForDefaultPerfMetric {
  29. FPRMSGPerfMetric *metric = [FPRMSGPerfMetric message];
  30. FPRGDTEvent *event = [FPRGDTEvent gdtEventForPerfMetric:metric];
  31. XCTAssertTrue([event transportBytes] > 0);
  32. }
  33. /** Validate that the instance has transportBytes for valid Perf Metric. */
  34. - (void)testInstanceHasTransportBytesForValidPerfMetric {
  35. FPRMSGPerfMetric *metric = [FPRTestUtils createRandomPerfMetric:@"t1"];
  36. FPRGDTEvent *event = [FPRGDTEvent gdtEventForPerfMetric:metric];
  37. XCTAssertTrue([event transportBytes] > 0);
  38. }
  39. @end