2 // LoggingServerTests.m
7 #include <AssertMacros.h>
8 #import <XCTest/XCTest.h>
10 #import "trust/trustd/SecTrustLoggingServer.h"
12 #import "TrustDaemonTestCase.h"
14 @interface LoggingServerTests : TrustDaemonTestCase
17 @implementation LoggingServerTests
19 - (void)testIntegerTruncation {
20 XCTAssertEqualObjects(TATruncateToSignificantFigures(5, 1), @(5));
21 XCTAssertEqualObjects(TATruncateToSignificantFigures(5, 2), @(5));
22 XCTAssertEqualObjects(TATruncateToSignificantFigures(42, 1), @(40));
23 XCTAssertEqualObjects(TATruncateToSignificantFigures(42, 2), @(42));
24 XCTAssertEqualObjects(TATruncateToSignificantFigures(-335, 1), @(-300));
25 XCTAssertEqualObjects(TATruncateToSignificantFigures(-335, 2), @(-330));
26 XCTAssertEqualObjects(TATruncateToSignificantFigures(-335, 3), @(-335));
27 XCTAssertEqualObjects(TATruncateToSignificantFigures(12345678901LL, 2), @(12000000000LL));
28 XCTAssertEqualObjects(TATruncateToSignificantFigures(12345678901LL, 7), @(12345670000LL));
29 XCTAssertEqualObjects(TATruncateToSignificantFigures(-12345678901LL, 3), @(-12300000000LL));