LoganTests.m 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /*
  2. * Copyright (c) 2018-present, 美团点评
  3. *
  4. * Permission is hereby granted, free of charge, to any person obtaining a copy
  5. * of this software and associated documentation files (the "Software"), to deal
  6. * in the Software without restriction, including without limitation the rights
  7. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  8. * copies of the Software, and to permit persons to whom the Software is
  9. * furnished to do so, subject to the following conditions:
  10. *
  11. * The above copyright notice and this permission notice shall be included in
  12. * all copies or substantial portions of the Software.
  13. *
  14. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  19. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  20. * THE SOFTWARE.
  21. */
  22. #import <XCTest/XCTest.h>
  23. #import "Logan.h"
  24. @interface LoganTests : XCTestCase
  25. @end
  26. @implementation LoganTests
  27. - (void)setUp {
  28. [super setUp];
  29. NSData *keydata = [@"0123456789012345" dataUsingEncoding:NSUTF8StringEncoding];
  30. NSData *ivdata = [@"0123456789012345" dataUsingEncoding:NSUTF8StringEncoding];
  31. uint64_t file_max = 10 * 1024 * 1024;
  32. loganInit(keydata, ivdata, file_max);
  33. logan(1, @"test");
  34. loganUseASL(YES);
  35. loganPrintClibLog(YES);
  36. }
  37. - (void)tearDown {
  38. [super tearDown];
  39. }
  40. - (void)testWirte {
  41. logan(1, @"test");
  42. }
  43. - (void)testClear {
  44. loganClearAllLogs();
  45. }
  46. - (void)testAllFilesInfo {
  47. NSDictionary *info = loganAllFilesInfo();
  48. XCTAssertNotNil(info, @"all files info should not be nil");
  49. }
  50. - (void)testTodaysDate {
  51. XCTAssertNotNil(loganTodaysDate(), @"todays date should not be nil");
  52. }
  53. - (void)testUploadFilePath {
  54. loganUploadFilePath(loganTodaysDate(), ^(NSString *_Nullable filePatch) {
  55. XCTAssertNotNil(filePatch, @"file patch should not be nil");
  56. });
  57. }
  58. - (void)testFlush {
  59. loganFlush();
  60. }
  61. @end