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.180 tracks/objective-c/exercises/run-length-encoding/RunLengthEncodingTest.m
trackler-2.2.1.179 tracks/objective-c/exercises/run-length-encoding/RunLengthEncodingTest.m
trackler-2.2.1.178 tracks/objective-c/exercises/run-length-encoding/RunLengthEncodingTest.m
trackler-2.2.1.177 tracks/objective-c/exercises/run-length-encoding/RunLengthEncodingTest.m
trackler-2.2.1.176 tracks/objective-c/exercises/run-length-encoding/RunLengthEncodingTest.m
trackler-2.2.1.175 tracks/objective-c/exercises/run-length-encoding/RunLengthEncodingTest.m
trackler-2.2.1.174 tracks/objective-c/exercises/run-length-encoding/RunLengthEncodingTest.m
trackler-2.2.1.173 tracks/objective-c/exercises/run-length-encoding/RunLengthEncodingTest.m
trackler-2.2.1.172 tracks/objective-c/exercises/run-length-encoding/RunLengthEncodingTest.m
trackler-2.2.1.171 tracks/objective-c/exercises/run-length-encoding/RunLengthEncodingTest.m
trackler-2.2.1.170 tracks/objective-c/exercises/run-length-encoding/RunLengthEncodingTest.m
trackler-2.2.1.169 tracks/objective-c/exercises/run-length-encoding/RunLengthEncodingTest.m
trackler-2.2.1.167 tracks/objective-c/exercises/run-length-encoding/RunLengthEncodingTest.m
trackler-2.2.1.166 tracks/objective-c/exercises/run-length-encoding/RunLengthEncodingTest.m
trackler-2.2.1.165 tracks/objective-c/exercises/run-length-encoding/RunLengthEncodingTest.m
trackler-2.2.1.164 tracks/objective-c/exercises/run-length-encoding/RunLengthEncodingTest.m
trackler-2.2.1.163 tracks/objective-c/exercises/run-length-encoding/RunLengthEncodingTest.m
trackler-2.2.1.162 tracks/objective-c/exercises/run-length-encoding/RunLengthEncodingTest.m
trackler-2.2.1.161 tracks/objective-c/exercises/run-length-encoding/RunLengthEncodingTest.m
trackler-2.2.1.160 tracks/objective-c/exercises/run-length-encoding/RunLengthEncodingTest.m