]> git.saurik.com Git - apple/security.git/blob - tests/TrustTests/DaemonTests/LoggingServerTests.m
Security-59306.41.2.tar.gz
[apple/security.git] / tests / TrustTests / DaemonTests / LoggingServerTests.m
1 //
2 // LoggingServerTests.m
3 // Security
4 //
5 // Created by Bailey Basile on 6/11/19.
6 //
7
8 #include <AssertMacros.h>
9 #import <XCTest/XCTest.h>
10
11 #import "trust/trustd/SecTrustLoggingServer.h"
12
13 @interface LoggingServerTests : XCTestCase
14 @end
15
16 @implementation LoggingServerTests
17
18 - (void)testIntegerTruncation {
19 XCTAssertEqualObjects(TATruncateToSignificantFigures(5, 1), @(5));
20 XCTAssertEqualObjects(TATruncateToSignificantFigures(5, 2), @(5));
21 XCTAssertEqualObjects(TATruncateToSignificantFigures(42, 1), @(40));
22 XCTAssertEqualObjects(TATruncateToSignificantFigures(42, 2), @(42));
23 XCTAssertEqualObjects(TATruncateToSignificantFigures(-335, 1), @(-300));
24 XCTAssertEqualObjects(TATruncateToSignificantFigures(-335, 2), @(-330));
25 XCTAssertEqualObjects(TATruncateToSignificantFigures(-335, 3), @(-335));
26 XCTAssertEqualObjects(TATruncateToSignificantFigures(12345678901LL, 2), @(12000000000LL));
27 XCTAssertEqualObjects(TATruncateToSignificantFigures(12345678901LL, 7), @(12345670000LL));
28 XCTAssertEqualObjects(TATruncateToSignificantFigures(-12345678901LL, 3), @(-12300000000LL));
29 }
30
31 @end