Sha256: a42a81ee7de9fca715849bb5bba228ae9bc513d7a7535c20369da2e6b7c150f8

Contents?: true

Size: 1.2 KB

Versions: 396

Compression:

Stored size: 1.2 KB

Contents

#import <XCTest/XCTest.h>

#if __has_include("RunLengthEncodingExample.h")
# import "RunLengthEncodingExample.h"
# else
# import "RunLengthEncoding.h"
#endif

@interface RunLengthEncodingTest : XCTestCase

@end

@implementation RunLengthEncodingTest

- (void)testEncodeSimple {
    XCTAssertEqualObjects([RunLengthEncoding encode:@"AABBBCCCC"], @"2A3B4C");
}

- (void)testDecodeSimple {
    XCTAssertEqualObjects([RunLengthEncoding decode:@"2A3B4C"], @"AABBBCCCC");
}

- (void)testEncodeWithSingleValues {
    XCTAssertEqualObjects([RunLengthEncoding encode:@"WWWWWWWWWWWWBWWWWWWWWWWWWBBBWWWWWWWWWWWWWWWWWWWWWWWWB"], @"12WB12W3B24WB");
}

- (void)testDecodeWithSingleValues {
    XCTAssertEqualObjects([RunLengthEncoding decode:@"12WB12W3B24WB"], @"WWWWWWWWWWWWBWWWWWWWWWWWWBBBWWWWWWWWWWWWWWWWWWWWWWWWB");
}

- (void)testDecodeEncodeCombination {
    XCTAssertEqualObjects([RunLengthEncoding decode:[RunLengthEncoding encode:@"zzz ZZ  zZ"]], @"zzz ZZ  zZ");
}

- (void)testEncodeUnicode {
    XCTAssertEqualObjects([RunLengthEncoding encode:@"⏰⚽⚽⚽⭐⭐⏰"], @"⏰3⚽2⭐⏰");
}

- (void)testDecodeUnicode {
    XCTAssertEqualObjects([RunLengthEncoding decode:@"⏰3⚽2⭐⏰"], @"⏰⚽⚽⚽⭐⭐⏰");
}

@end

Version data entries

396 entries across 396 versions & 1 rubygems

Version Path
trackler-2.2.1.139 tracks/objective-c/exercises/run-length-encoding/RunLengthEncodingTest.m
trackler-2.2.1.138 tracks/objective-c/exercises/run-length-encoding/RunLengthEncodingTest.m
trackler-2.2.1.137 tracks/objective-c/exercises/run-length-encoding/RunLengthEncodingTest.m
trackler-2.2.1.136 tracks/objective-c/exercises/run-length-encoding/RunLengthEncodingTest.m
trackler-2.2.1.135 tracks/objective-c/exercises/run-length-encoding/RunLengthEncodingTest.m
trackler-2.2.1.134 tracks/objective-c/exercises/run-length-encoding/RunLengthEncodingTest.m
trackler-2.2.1.133 tracks/objective-c/exercises/run-length-encoding/RunLengthEncodingTest.m
trackler-2.2.1.132 tracks/objective-c/exercises/run-length-encoding/RunLengthEncodingTest.m
trackler-2.2.1.131 tracks/objective-c/exercises/run-length-encoding/RunLengthEncodingTest.m
trackler-2.2.1.130 tracks/objective-c/exercises/run-length-encoding/RunLengthEncodingTest.m
trackler-2.2.1.129 tracks/objective-c/exercises/run-length-encoding/RunLengthEncodingTest.m
trackler-2.2.1.128 tracks/objective-c/exercises/run-length-encoding/RunLengthEncodingTest.m
trackler-2.2.1.127 tracks/objective-c/exercises/run-length-encoding/RunLengthEncodingTest.m
trackler-2.2.1.126 tracks/objective-c/exercises/run-length-encoding/RunLengthEncodingTest.m
trackler-2.2.1.125 tracks/objective-c/exercises/run-length-encoding/RunLengthEncodingTest.m
trackler-2.2.1.124 tracks/objective-c/exercises/run-length-encoding/RunLengthEncodingTest.m
trackler-2.2.1.123 tracks/objective-c/exercises/run-length-encoding/RunLengthEncodingTest.m
trackler-2.2.1.122 tracks/objective-c/exercises/run-length-encoding/RunLengthEncodingTest.m
trackler-2.2.1.121 tracks/objective-c/exercises/run-length-encoding/RunLengthEncodingTest.m
trackler-2.2.1.120 tracks/objective-c/exercises/run-length-encoding/RunLengthEncodingTest.m