Compare commits
49 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d7daeb0518 | |||
| 9b6c798a17 | |||
| 959f4f0eb1 | |||
| 040aadd65f | |||
| b6a99e3ffe | |||
| 20d4d7e7c4 | |||
| a8a69e4570 | |||
| cea6cb0952 | |||
| fae6eb2617 | |||
| 0e3030af48 | |||
| 9a255de350 | |||
| ca1fc87240 | |||
| dff7877e06 | |||
| 32ec1a11ce | |||
| 4d8f31303a | |||
| b4da0afe8b | |||
| 34e3aa1c95 | |||
| 0ec1461200 | |||
| 3706b45822 | |||
| 2438623b7c | |||
| af69193370 | |||
| 20c169a7b8 | |||
| 87efd44e09 | |||
| e7bba55479 | |||
| 4dcdf588ee | |||
| 4065061d25 | |||
| 60ffb98742 | |||
| d70db906df | |||
| 30bb351de2 | |||
| 0022833380 | |||
| 1219d6dd8a | |||
| c5e6b63a9c | |||
| a2d0ef2c1b | |||
| 61729a772b | |||
| 5e51f91e07 | |||
| 5acd33d10a | |||
| 1a4623ceff | |||
| 8016abd95b | |||
| e58469f8e4 | |||
| 100e077a0d | |||
| 72ccef23af | |||
| 1a9ac85931 | |||
| 9074b8abe8 | |||
| 7f58e9ae8d | |||
| feffcd9041 | |||
| e963b30ff8 | |||
| 23725866ab | |||
| 9aa12bb2aa | |||
| 4bcf559767 |
+1
-2
@@ -26,5 +26,4 @@ DerivedData
|
||||
*.xctimeline
|
||||
|
||||
# Carthage
|
||||
Carthage/Checkouts
|
||||
Carthage/**/OrderedDictionary*
|
||||
Carthage
|
||||
|
||||
+6
-6
@@ -1,13 +1,13 @@
|
||||
language: objective-c
|
||||
osx_image: xcode8
|
||||
|
||||
xcode_project: OrderedDictionary.xcodeproj
|
||||
xcode_scheme: OrderedDictionary-iOS
|
||||
xcode_sdk: iphonesimulator
|
||||
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
|
||||
xcode_project: OrderedDictionary.xcodeproj
|
||||
xcode_scheme: OrderedDictionary-iOS
|
||||
osx_image: xcode7
|
||||
xcode_sdk: iphonesimulator
|
||||
|
||||
script:
|
||||
- xcodebuild clean build test -project OrderedDictionary.xcodeproj -scheme OrderedDictionary-iOS -destination "platform=iOS Simulator,name=iPhone 6,OS=9.0"
|
||||
- xcodebuild clean build test -project OrderedDictionary.xcodeproj -scheme OrderedDictionary-iOS -destination "platform=iOS Simulator,name=iPhone 6s,OS=10.0"
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
github "Quick/Nimble" "e84623d953d811f74a2afcda4fa0c8121e7dad7d"
|
||||
@@ -1 +0,0 @@
|
||||
github "Quick/Nimble" "e84623d953d811f74a2afcda4fa0c8121e7dad7d"
|
||||
-20
@@ -1,20 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>English</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.apple.xcode.dsym.net.jeffhui.Nimble</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>dSYM</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1</string>
|
||||
</dict>
|
||||
</plist>
|
||||
BIN
Binary file not shown.
-1
@@ -1 +0,0 @@
|
||||
Versions/Current/Headers
|
||||
-1
@@ -1 +0,0 @@
|
||||
Versions/Current/Modules
|
||||
-1
@@ -1 +0,0 @@
|
||||
Versions/Current/Nimble
|
||||
-1
@@ -1 +0,0 @@
|
||||
Versions/Current/Resources
|
||||
-129
@@ -1,129 +0,0 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@class NMBExpectation;
|
||||
@class NMBObjCBeCloseToMatcher;
|
||||
@class NMBObjCRaiseExceptionMatcher;
|
||||
@protocol NMBMatcher;
|
||||
|
||||
|
||||
#define NIMBLE_EXPORT FOUNDATION_EXPORT
|
||||
|
||||
#ifdef NIMBLE_DISABLE_SHORT_SYNTAX
|
||||
#define NIMBLE_SHORT(PROTO, ORIGINAL)
|
||||
#else
|
||||
#define NIMBLE_SHORT(PROTO, ORIGINAL) FOUNDATION_STATIC_INLINE PROTO { return (ORIGINAL); }
|
||||
#endif
|
||||
|
||||
NIMBLE_EXPORT NMBExpectation *NMB_expect(id(^actualBlock)(), NSString *file, NSUInteger line);
|
||||
NIMBLE_EXPORT NMBExpectation *NMB_expectAction(void(^actualBlock)(), NSString *file, NSUInteger line);
|
||||
|
||||
NIMBLE_EXPORT id<NMBMatcher> NMB_equal(id expectedValue);
|
||||
NIMBLE_SHORT(id<NMBMatcher> equal(id expectedValue),
|
||||
NMB_equal(expectedValue));
|
||||
|
||||
NIMBLE_EXPORT NMBObjCBeCloseToMatcher *NMB_beCloseTo(NSNumber *expectedValue);
|
||||
NIMBLE_SHORT(NMBObjCBeCloseToMatcher *beCloseTo(id expectedValue),
|
||||
NMB_beCloseTo(expectedValue));
|
||||
|
||||
NIMBLE_EXPORT id<NMBMatcher> NMB_beAnInstanceOf(Class expectedClass);
|
||||
NIMBLE_SHORT(id<NMBMatcher> beAnInstanceOf(Class expectedClass),
|
||||
NMB_beAnInstanceOf(expectedClass));
|
||||
|
||||
NIMBLE_EXPORT id<NMBMatcher> NMB_beAKindOf(Class expectedClass);
|
||||
NIMBLE_SHORT(id<NMBMatcher> beAKindOf(Class expectedClass),
|
||||
NMB_beAKindOf(expectedClass));
|
||||
|
||||
NIMBLE_EXPORT id<NMBMatcher> NMB_beginWith(id itemElementOrSubstring);
|
||||
NIMBLE_SHORT(id<NMBMatcher> beginWith(id itemElementOrSubstring),
|
||||
NMB_beginWith(itemElementOrSubstring));
|
||||
|
||||
NIMBLE_EXPORT id<NMBMatcher> NMB_beGreaterThan(NSNumber *expectedValue);
|
||||
NIMBLE_SHORT(id<NMBMatcher> beGreaterThan(NSNumber *expectedValue),
|
||||
NMB_beGreaterThan(expectedValue));
|
||||
|
||||
NIMBLE_EXPORT id<NMBMatcher> NMB_beGreaterThanOrEqualTo(NSNumber *expectedValue);
|
||||
NIMBLE_SHORT(id<NMBMatcher> beGreaterThanOrEqualTo(NSNumber *expectedValue),
|
||||
NMB_beGreaterThanOrEqualTo(expectedValue));
|
||||
|
||||
NIMBLE_EXPORT id<NMBMatcher> NMB_beIdenticalTo(id expectedInstance);
|
||||
NIMBLE_SHORT(id<NMBMatcher> beIdenticalTo(id expectedInstance),
|
||||
NMB_beIdenticalTo(expectedInstance));
|
||||
|
||||
NIMBLE_EXPORT id<NMBMatcher> NMB_beLessThan(NSNumber *expectedValue);
|
||||
NIMBLE_SHORT(id<NMBMatcher> beLessThan(NSNumber *expectedValue),
|
||||
NMB_beLessThan(expectedValue));
|
||||
|
||||
NIMBLE_EXPORT id<NMBMatcher> NMB_beLessThanOrEqualTo(NSNumber *expectedValue);
|
||||
NIMBLE_SHORT(id<NMBMatcher> beLessThanOrEqualTo(NSNumber *expectedValue),
|
||||
NMB_beLessThanOrEqualTo(expectedValue));
|
||||
|
||||
NIMBLE_EXPORT id<NMBMatcher> NMB_beTruthy(void);
|
||||
NIMBLE_SHORT(id<NMBMatcher> beTruthy(void),
|
||||
NMB_beTruthy());
|
||||
|
||||
NIMBLE_EXPORT id<NMBMatcher> NMB_beFalsy(void);
|
||||
NIMBLE_SHORT(id<NMBMatcher> beFalsy(void),
|
||||
NMB_beFalsy());
|
||||
|
||||
NIMBLE_EXPORT id<NMBMatcher> NMB_beTrue(void);
|
||||
NIMBLE_SHORT(id<NMBMatcher> beTrue(void),
|
||||
NMB_beTrue());
|
||||
|
||||
NIMBLE_EXPORT id<NMBMatcher> NMB_beFalse(void);
|
||||
NIMBLE_SHORT(id<NMBMatcher> beFalse(void),
|
||||
NMB_beFalse());
|
||||
|
||||
NIMBLE_EXPORT id<NMBMatcher> NMB_beNil(void);
|
||||
NIMBLE_SHORT(id<NMBMatcher> beNil(void),
|
||||
NMB_beNil());
|
||||
|
||||
NIMBLE_EXPORT id<NMBMatcher> NMB_beEmpty(void);
|
||||
NIMBLE_SHORT(id<NMBMatcher> beEmpty(void),
|
||||
NMB_beEmpty());
|
||||
|
||||
NIMBLE_EXPORT id<NMBMatcher> NMB_containWithNilTermination(id itemOrSubstring, ...) NS_REQUIRES_NIL_TERMINATION;
|
||||
#define NMB_contain(...) NMB_containWithNilTermination(__VA_ARGS__, nil)
|
||||
#ifndef NIMBLE_DISABLE_SHORT_SYNTAX
|
||||
#define contain(...) NMB_contain(__VA_ARGS__)
|
||||
#endif
|
||||
|
||||
NIMBLE_EXPORT id<NMBMatcher> NMB_endWith(id itemElementOrSubstring);
|
||||
NIMBLE_SHORT(id<NMBMatcher> endWith(id itemElementOrSubstring),
|
||||
NMB_endWith(itemElementOrSubstring));
|
||||
|
||||
NIMBLE_EXPORT NMBObjCRaiseExceptionMatcher *NMB_raiseException(void);
|
||||
NIMBLE_SHORT(NMBObjCRaiseExceptionMatcher *raiseException(void),
|
||||
NMB_raiseException());
|
||||
|
||||
NIMBLE_EXPORT id<NMBMatcher> NMB_match(id expectedValue);
|
||||
NIMBLE_SHORT(id<NMBMatcher> match(id expectedValue),
|
||||
NMB_match(expectedValue));
|
||||
|
||||
NIMBLE_EXPORT id<NMBMatcher> NMB_allPass(id matcher);
|
||||
NIMBLE_SHORT(id<NMBMatcher> allPass(id matcher),
|
||||
NMB_allPass(matcher));
|
||||
|
||||
// In order to preserve breakpoint behavior despite using macros to fill in __FILE__ and __LINE__,
|
||||
// define a builder that populates __FILE__ and __LINE__, and returns a block that takes timeout
|
||||
// and action arguments. See https://github.com/Quick/Quick/pull/185 for details.
|
||||
typedef void (^NMBWaitUntilTimeoutBlock)(NSTimeInterval timeout, void (^action)(void (^)(void)));
|
||||
typedef void (^NMBWaitUntilBlock)(void (^action)(void (^)(void)));
|
||||
|
||||
NIMBLE_EXPORT NMBWaitUntilTimeoutBlock NMB_waitUntilTimeoutBuilder(NSString *file, NSUInteger line);
|
||||
NIMBLE_EXPORT NMBWaitUntilBlock NMB_waitUntilBuilder(NSString *file, NSUInteger line);
|
||||
|
||||
NIMBLE_EXPORT void NMB_failWithMessage(NSString *msg, NSString *file, NSUInteger line);
|
||||
|
||||
#define NMB_waitUntilTimeout NMB_waitUntilTimeoutBuilder(@(__FILE__), __LINE__)
|
||||
#define NMB_waitUntil NMB_waitUntilBuilder(@(__FILE__), __LINE__)
|
||||
|
||||
#ifndef NIMBLE_DISABLE_SHORT_SYNTAX
|
||||
#define expect(...) NMB_expect(^id{ return (__VA_ARGS__); }, @(__FILE__), __LINE__)
|
||||
#define expectAction(BLOCK) NMB_expectAction((BLOCK), @(__FILE__), __LINE__)
|
||||
#define failWithMessage(msg) NMB_failWithMessage(msg, @(__FILE__), __LINE__)
|
||||
#define fail() failWithMessage(@"fail() always fails")
|
||||
|
||||
|
||||
#define waitUntilTimeout NMB_waitUntilTimeout
|
||||
#define waitUntil NMB_waitUntil
|
||||
#endif
|
||||
-8
@@ -1,8 +0,0 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface NMBExceptionCapture : NSObject
|
||||
|
||||
- (id)initWithHandler:(void(^)(NSException *))handler finally:(void(^)())finally;
|
||||
- (void)tryBlock:(void(^)())unsafeBlock;
|
||||
|
||||
@end
|
||||
-364
@@ -1,364 +0,0 @@
|
||||
// Generated by Apple Swift version 2.0 (swiftlang-700.0.57.3 clang-700.0.72)
|
||||
#pragma clang diagnostic push
|
||||
|
||||
#if defined(__has_include) && __has_include(<swift/objc-prologue.h>)
|
||||
# include <swift/objc-prologue.h>
|
||||
#endif
|
||||
|
||||
#pragma clang diagnostic ignored "-Wauto-import"
|
||||
#include <objc/NSObject.h>
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#if defined(__has_include) && __has_include(<uchar.h>)
|
||||
# include <uchar.h>
|
||||
#elif !defined(__cplusplus) || __cplusplus < 201103L
|
||||
typedef uint_least16_t char16_t;
|
||||
typedef uint_least32_t char32_t;
|
||||
#endif
|
||||
|
||||
typedef struct _NSZone NSZone;
|
||||
|
||||
#if !defined(SWIFT_PASTE)
|
||||
# define SWIFT_PASTE_HELPER(x, y) x##y
|
||||
# define SWIFT_PASTE(x, y) SWIFT_PASTE_HELPER(x, y)
|
||||
#endif
|
||||
#if !defined(SWIFT_METATYPE)
|
||||
# define SWIFT_METATYPE(X) Class
|
||||
#endif
|
||||
|
||||
#if defined(__has_attribute) && __has_attribute(objc_runtime_name)
|
||||
# define SWIFT_RUNTIME_NAME(X) __attribute__((objc_runtime_name(X)))
|
||||
#else
|
||||
# define SWIFT_RUNTIME_NAME(X)
|
||||
#endif
|
||||
#if defined(__has_attribute) && __has_attribute(swift_name)
|
||||
# define SWIFT_COMPILE_NAME(X) __attribute__((swift_name(X)))
|
||||
#else
|
||||
# define SWIFT_COMPILE_NAME(X)
|
||||
#endif
|
||||
#if !defined(SWIFT_CLASS_EXTRA)
|
||||
# define SWIFT_CLASS_EXTRA
|
||||
#endif
|
||||
#if !defined(SWIFT_PROTOCOL_EXTRA)
|
||||
# define SWIFT_PROTOCOL_EXTRA
|
||||
#endif
|
||||
#if !defined(SWIFT_ENUM_EXTRA)
|
||||
# define SWIFT_ENUM_EXTRA
|
||||
#endif
|
||||
#if !defined(SWIFT_CLASS)
|
||||
# if defined(__has_attribute) && __has_attribute(objc_subclassing_restricted)
|
||||
# define SWIFT_CLASS(SWIFT_NAME) SWIFT_RUNTIME_NAME(SWIFT_NAME) __attribute__((objc_subclassing_restricted)) SWIFT_CLASS_EXTRA
|
||||
# define SWIFT_CLASS_NAMED(SWIFT_NAME) __attribute__((objc_subclassing_restricted)) SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_CLASS_EXTRA
|
||||
# else
|
||||
# define SWIFT_CLASS(SWIFT_NAME) SWIFT_RUNTIME_NAME(SWIFT_NAME) SWIFT_CLASS_EXTRA
|
||||
# define SWIFT_CLASS_NAMED(SWIFT_NAME) SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_CLASS_EXTRA
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if !defined(SWIFT_PROTOCOL)
|
||||
# define SWIFT_PROTOCOL(SWIFT_NAME) SWIFT_RUNTIME_NAME(SWIFT_NAME) SWIFT_PROTOCOL_EXTRA
|
||||
# define SWIFT_PROTOCOL_NAMED(SWIFT_NAME) SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_PROTOCOL_EXTRA
|
||||
#endif
|
||||
|
||||
#if !defined(SWIFT_EXTENSION)
|
||||
# define SWIFT_EXTENSION(M) SWIFT_PASTE(M##_Swift_, __LINE__)
|
||||
#endif
|
||||
|
||||
#if !defined(OBJC_DESIGNATED_INITIALIZER)
|
||||
# if defined(__has_attribute) && __has_attribute(objc_designated_initializer)
|
||||
# define OBJC_DESIGNATED_INITIALIZER __attribute__((objc_designated_initializer))
|
||||
# else
|
||||
# define OBJC_DESIGNATED_INITIALIZER
|
||||
# endif
|
||||
#endif
|
||||
#if !defined(SWIFT_ENUM)
|
||||
# define SWIFT_ENUM(_type, _name) enum _name : _type _name; enum SWIFT_ENUM_EXTRA _name : _type
|
||||
#endif
|
||||
typedef float swift_float2 __attribute__((__ext_vector_type__(2)));
|
||||
typedef float swift_float3 __attribute__((__ext_vector_type__(3)));
|
||||
typedef float swift_float4 __attribute__((__ext_vector_type__(4)));
|
||||
typedef double swift_double2 __attribute__((__ext_vector_type__(2)));
|
||||
typedef double swift_double3 __attribute__((__ext_vector_type__(3)));
|
||||
typedef double swift_double4 __attribute__((__ext_vector_type__(4)));
|
||||
typedef int swift_int2 __attribute__((__ext_vector_type__(2)));
|
||||
typedef int swift_int3 __attribute__((__ext_vector_type__(3)));
|
||||
typedef int swift_int4 __attribute__((__ext_vector_type__(4)));
|
||||
#if defined(__has_feature) && __has_feature(modules)
|
||||
@import ObjectiveC;
|
||||
@import Foundation;
|
||||
#endif
|
||||
|
||||
#pragma clang diagnostic ignored "-Wproperty-attribute-mismatch"
|
||||
#pragma clang diagnostic ignored "-Wduplicate-method-arg"
|
||||
|
||||
|
||||
/// Encapsulates the failure message that matchers can report to the end user.
|
||||
///
|
||||
/// This is shared state between Nimble and matchers that mutate this value.
|
||||
SWIFT_CLASS("_TtC6Nimble14FailureMessage")
|
||||
@interface FailureMessage : NSObject
|
||||
@property (nonatomic, copy) NSString * __nonnull expected;
|
||||
@property (nonatomic, copy) NSString * __nullable actualValue;
|
||||
@property (nonatomic, copy) NSString * __nonnull to;
|
||||
@property (nonatomic, copy) NSString * __nonnull postfixMessage;
|
||||
@property (nonatomic, copy) NSString * __nonnull postfixActual;
|
||||
@property (nonatomic, copy) NSString * __nullable userDescription;
|
||||
@property (nonatomic, copy) NSString * __nonnull stringValue;
|
||||
- (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER;
|
||||
- (nonnull instancetype)initWithStringValue:(NSString * __nonnull)stringValue OBJC_DESIGNATED_INITIALIZER;
|
||||
@end
|
||||
|
||||
|
||||
|
||||
/// Protocol for types that support only beEmpty()
|
||||
SWIFT_PROTOCOL("_TtP6Nimble13NMBCollection_")
|
||||
@protocol NMBCollection
|
||||
@property (nonatomic, readonly) NSInteger count;
|
||||
@end
|
||||
|
||||
|
||||
|
||||
/// Protocol for types to support beLessThan(), beLessThanOrEqualTo(), beGreaterThan(), beGreaterThanOrEqualTo(), and equal() matchers.
|
||||
///
|
||||
/// Types that conform to Swift's Comparable protocol will work implicitly too
|
||||
SWIFT_PROTOCOL("_TtP6Nimble13NMBComparable_")
|
||||
@protocol NMBComparable
|
||||
- (NSComparisonResult)NMB_compare:(id <NMBComparable> __null_unspecified)otherObject;
|
||||
@end
|
||||
|
||||
|
||||
|
||||
/// Protocol for types that support contain() matcher.
|
||||
SWIFT_PROTOCOL("_TtP6Nimble12NMBContainer_")
|
||||
@protocol NMBContainer
|
||||
- (BOOL)containsObject:(id __null_unspecified)object;
|
||||
@end
|
||||
|
||||
|
||||
|
||||
/// Protocol for types to support beCloseTo() matcher
|
||||
SWIFT_PROTOCOL("_TtP6Nimble20NMBDoubleConvertible_")
|
||||
@protocol NMBDoubleConvertible
|
||||
@property (nonatomic, readonly) double doubleValue;
|
||||
@end
|
||||
|
||||
@protocol NMBMatcher;
|
||||
|
||||
SWIFT_CLASS("_TtC6Nimble14NMBExpectation")
|
||||
@interface NMBExpectation : NSObject
|
||||
- (nonnull instancetype)initWithActualBlock:(NSObject * __null_unspecified (^ __nonnull)(void))actualBlock negative:(BOOL)negative file:(NSString * __nonnull)file line:(NSUInteger)line OBJC_DESIGNATED_INITIALIZER;
|
||||
@property (nonatomic, readonly, copy) NMBExpectation * __nonnull (^ __nonnull withTimeout)(NSTimeInterval);
|
||||
@property (nonatomic, readonly, copy) void (^ __nonnull to)(id <NMBMatcher> __nonnull);
|
||||
@property (nonatomic, readonly, copy) void (^ __nonnull toWithDescription)(id <NMBMatcher> __nonnull, NSString * __nonnull);
|
||||
@property (nonatomic, readonly, copy) void (^ __nonnull toNot)(id <NMBMatcher> __nonnull);
|
||||
@property (nonatomic, readonly, copy) void (^ __nonnull toNotWithDescription)(id <NMBMatcher> __nonnull, NSString * __nonnull);
|
||||
@property (nonatomic, readonly, copy) void (^ __nonnull notTo)(id <NMBMatcher> __nonnull);
|
||||
@property (nonatomic, readonly, copy) void (^ __nonnull notToWithDescription)(id <NMBMatcher> __nonnull, NSString * __nonnull);
|
||||
@property (nonatomic, readonly, copy) void (^ __nonnull toEventually)(id <NMBMatcher> __nonnull);
|
||||
@property (nonatomic, readonly, copy) void (^ __nonnull toEventuallyWithDescription)(id <NMBMatcher> __nonnull, NSString * __nonnull);
|
||||
@property (nonatomic, readonly, copy) void (^ __nonnull toEventuallyNot)(id <NMBMatcher> __nonnull);
|
||||
@property (nonatomic, readonly, copy) void (^ __nonnull toEventuallyNotWithDescription)(id <NMBMatcher> __nonnull, NSString * __nonnull);
|
||||
@property (nonatomic, readonly, copy) void (^ __nonnull toNotEventually)(id <NMBMatcher> __nonnull);
|
||||
@property (nonatomic, readonly, copy) void (^ __nonnull toNotEventuallyWithDescription)(id <NMBMatcher> __nonnull, NSString * __nonnull);
|
||||
+ (void)failWithMessage:(NSString * __nonnull)message file:(NSString * __nonnull)file line:(NSUInteger)line;
|
||||
@end
|
||||
|
||||
@class SourceLocation;
|
||||
|
||||
|
||||
/// Objective-C interface to the Swift variant of Matcher.
|
||||
SWIFT_PROTOCOL("_TtP6Nimble10NMBMatcher_")
|
||||
@protocol NMBMatcher
|
||||
- (BOOL)matches:(NSObject * __null_unspecified (^ __nonnull)(void))actualBlock failureMessage:(FailureMessage * __nonnull)failureMessage location:(SourceLocation * __nonnull)location;
|
||||
- (BOOL)doesNotMatch:(NSObject * __null_unspecified (^ __nonnull)(void))actualBlock failureMessage:(FailureMessage * __nonnull)failureMessage location:(SourceLocation * __nonnull)location;
|
||||
@end
|
||||
|
||||
|
||||
SWIFT_CLASS("_TtC6Nimble23NMBObjCBeCloseToMatcher")
|
||||
@interface NMBObjCBeCloseToMatcher : NSObject <NMBMatcher>
|
||||
- (BOOL)matches:(NSObject * __null_unspecified (^ __nonnull)(void))actualExpression failureMessage:(FailureMessage * __nonnull)failureMessage location:(SourceLocation * __nonnull)location;
|
||||
- (BOOL)doesNotMatch:(NSObject * __null_unspecified (^ __nonnull)(void))actualExpression failureMessage:(FailureMessage * __nonnull)failureMessage location:(SourceLocation * __nonnull)location;
|
||||
@property (nonatomic, readonly, copy) NMBObjCBeCloseToMatcher * __nonnull (^ __nonnull within)(double);
|
||||
@end
|
||||
|
||||
|
||||
SWIFT_CLASS("_TtC6Nimble14NMBObjCMatcher")
|
||||
@interface NMBObjCMatcher : NSObject <NMBMatcher>
|
||||
- (BOOL)matches:(NSObject * __null_unspecified (^ __nonnull)(void))actualBlock failureMessage:(FailureMessage * __nonnull)failureMessage location:(SourceLocation * __nonnull)location;
|
||||
- (BOOL)doesNotMatch:(NSObject * __null_unspecified (^ __nonnull)(void))actualBlock failureMessage:(FailureMessage * __nonnull)failureMessage location:(SourceLocation * __nonnull)location;
|
||||
@end
|
||||
|
||||
|
||||
@interface NMBObjCMatcher (SWIFT_EXTENSION(Nimble))
|
||||
+ (NMBObjCMatcher * __nonnull)beEmptyMatcher;
|
||||
@end
|
||||
|
||||
|
||||
@interface NMBObjCMatcher (SWIFT_EXTENSION(Nimble))
|
||||
+ (NMBObjCMatcher * __nonnull)beIdenticalToMatcher:(NSObject * __nullable)expected;
|
||||
@end
|
||||
|
||||
|
||||
@interface NMBObjCMatcher (SWIFT_EXTENSION(Nimble))
|
||||
+ (NMBObjCMatcher * __nonnull)beginWithMatcher:(id __nonnull)expected;
|
||||
@end
|
||||
|
||||
|
||||
@interface NMBObjCMatcher (SWIFT_EXTENSION(Nimble))
|
||||
+ (NMBObjCMatcher * __nonnull)beGreaterThanOrEqualToMatcher:(id <NMBComparable> __nullable)expected;
|
||||
@end
|
||||
|
||||
|
||||
@interface NMBObjCMatcher (SWIFT_EXTENSION(Nimble))
|
||||
+ (NMBObjCMatcher * __nonnull)containMatcher:(NSArray<NSObject *> * __nonnull)expected;
|
||||
@end
|
||||
|
||||
|
||||
@interface NMBObjCMatcher (SWIFT_EXTENSION(Nimble))
|
||||
+ (NMBObjCMatcher * __nonnull)beGreaterThanMatcher:(id <NMBComparable> __nullable)expected;
|
||||
@end
|
||||
|
||||
|
||||
@interface NMBObjCMatcher (SWIFT_EXTENSION(Nimble))
|
||||
+ (NMBObjCMatcher * __nonnull)beLessThanMatcher:(id <NMBComparable> __nullable)expected;
|
||||
@end
|
||||
|
||||
|
||||
@interface NMBObjCMatcher (SWIFT_EXTENSION(Nimble))
|
||||
+ (id <NMBMatcher> __nonnull)equalMatcher:(NSObject * __nonnull)expected;
|
||||
@end
|
||||
|
||||
@class NSString;
|
||||
|
||||
@interface NMBObjCMatcher (SWIFT_EXTENSION(Nimble))
|
||||
+ (id <NMBMatcher> __nonnull)matchMatcher:(NSString * __nonnull)expected;
|
||||
@end
|
||||
|
||||
|
||||
@interface NMBObjCMatcher (SWIFT_EXTENSION(Nimble))
|
||||
+ (id <NMBMatcher> __nonnull)beAKindOfMatcher:(Class __nonnull)expected;
|
||||
@end
|
||||
|
||||
|
||||
@interface NMBObjCMatcher (SWIFT_EXTENSION(Nimble))
|
||||
+ (NMBObjCMatcher * __nonnull)allPassMatcher:(NMBObjCMatcher * __nonnull)matcher;
|
||||
@end
|
||||
|
||||
|
||||
@interface NMBObjCMatcher (SWIFT_EXTENSION(Nimble))
|
||||
+ (id <NMBMatcher> __nonnull)beAnInstanceOfMatcher:(Class __nonnull)expected;
|
||||
@end
|
||||
|
||||
|
||||
@interface NMBObjCMatcher (SWIFT_EXTENSION(Nimble))
|
||||
+ (NMBObjCMatcher * __nonnull)beLessThanOrEqualToMatcher:(id <NMBComparable> __nullable)expected;
|
||||
@end
|
||||
|
||||
@class NSNumber;
|
||||
|
||||
@interface NMBObjCMatcher (SWIFT_EXTENSION(Nimble))
|
||||
+ (NMBObjCBeCloseToMatcher * __nonnull)beCloseToMatcher:(NSNumber * __nonnull)expected within:(double)within;
|
||||
@end
|
||||
|
||||
@class NMBObjCRaiseExceptionMatcher;
|
||||
|
||||
@interface NMBObjCMatcher (SWIFT_EXTENSION(Nimble))
|
||||
+ (NMBObjCRaiseExceptionMatcher * __nonnull)raiseExceptionMatcher;
|
||||
@end
|
||||
|
||||
|
||||
@interface NMBObjCMatcher (SWIFT_EXTENSION(Nimble))
|
||||
+ (NMBObjCMatcher * __nonnull)endWithMatcher:(id __nonnull)expected;
|
||||
@end
|
||||
|
||||
|
||||
@interface NMBObjCMatcher (SWIFT_EXTENSION(Nimble))
|
||||
+ (NMBObjCMatcher * __nonnull)beNilMatcher;
|
||||
@end
|
||||
|
||||
|
||||
@interface NMBObjCMatcher (SWIFT_EXTENSION(Nimble))
|
||||
+ (NMBObjCMatcher * __nonnull)beTruthyMatcher;
|
||||
+ (NMBObjCMatcher * __nonnull)beFalsyMatcher;
|
||||
+ (NMBObjCMatcher * __nonnull)beTrueMatcher;
|
||||
+ (NMBObjCMatcher * __nonnull)beFalseMatcher;
|
||||
@end
|
||||
|
||||
@class NSDictionary;
|
||||
@class NSException;
|
||||
|
||||
SWIFT_CLASS("_TtC6Nimble28NMBObjCRaiseExceptionMatcher")
|
||||
@interface NMBObjCRaiseExceptionMatcher : NSObject <NMBMatcher>
|
||||
- (BOOL)matches:(NSObject * __null_unspecified (^ __nonnull)(void))actualBlock failureMessage:(FailureMessage * __nonnull)failureMessage location:(SourceLocation * __nonnull)location;
|
||||
- (BOOL)doesNotMatch:(NSObject * __null_unspecified (^ __nonnull)(void))actualBlock failureMessage:(FailureMessage * __nonnull)failureMessage location:(SourceLocation * __nonnull)location;
|
||||
@property (nonatomic, readonly, copy) NMBObjCRaiseExceptionMatcher * __nonnull (^ __nonnull named)(NSString * __nonnull);
|
||||
@property (nonatomic, readonly, copy) NMBObjCRaiseExceptionMatcher * __nonnull (^ __nonnull reason)(NSString * __nullable);
|
||||
@property (nonatomic, readonly, copy) NMBObjCRaiseExceptionMatcher * __nonnull (^ __nonnull userInfo)(NSDictionary * __nullable);
|
||||
@property (nonatomic, readonly, copy) NMBObjCRaiseExceptionMatcher * __nonnull (^ __nonnull satisfyingBlock)(void (^ __nullable)(NSException * __nonnull));
|
||||
@end
|
||||
|
||||
|
||||
|
||||
/// Protocol for types that support beginWith(), endWith(), beEmpty() matchers
|
||||
SWIFT_PROTOCOL("_TtP6Nimble20NMBOrderedCollection_")
|
||||
@protocol NMBOrderedCollection <NMBCollection>
|
||||
- (NSInteger)indexOfObject:(id __null_unspecified)object;
|
||||
@end
|
||||
|
||||
|
||||
@interface NSArray (SWIFT_EXTENSION(Nimble)) <NMBContainer>
|
||||
@end
|
||||
|
||||
|
||||
@interface NSArray (SWIFT_EXTENSION(Nimble)) <NMBOrderedCollection, NMBCollection>
|
||||
@end
|
||||
|
||||
|
||||
@interface NSArray (SWIFT_EXTENSION(Nimble))
|
||||
@end
|
||||
|
||||
|
||||
@interface NSDictionary (SWIFT_EXTENSION(Nimble)) <NMBCollection>
|
||||
@end
|
||||
|
||||
|
||||
@interface NSHashTable (SWIFT_EXTENSION(Nimble)) <NMBContainer>
|
||||
@end
|
||||
|
||||
|
||||
@interface NSHashTable (SWIFT_EXTENSION(Nimble)) <NMBCollection>
|
||||
@end
|
||||
|
||||
|
||||
@interface NSNumber (SWIFT_EXTENSION(Nimble)) <NMBDoubleConvertible>
|
||||
@end
|
||||
|
||||
|
||||
@interface NSNumber (SWIFT_EXTENSION(Nimble)) <NMBComparable>
|
||||
- (NSComparisonResult)NMB_compare:(id <NMBComparable> __null_unspecified)otherObject;
|
||||
@end
|
||||
|
||||
|
||||
@interface NSSet (SWIFT_EXTENSION(Nimble)) <NMBCollection>
|
||||
@end
|
||||
|
||||
|
||||
@interface NSSet (SWIFT_EXTENSION(Nimble)) <NMBContainer>
|
||||
@end
|
||||
|
||||
|
||||
@interface NSString (SWIFT_EXTENSION(Nimble)) <NMBComparable>
|
||||
- (NSComparisonResult)NMB_compare:(id <NMBComparable> __null_unspecified)otherObject;
|
||||
@end
|
||||
|
||||
|
||||
SWIFT_CLASS("_TtC6Nimble14SourceLocation")
|
||||
@interface SourceLocation : NSObject
|
||||
@property (nonatomic, readonly, copy) NSString * __nonnull file;
|
||||
@property (nonatomic, readonly) NSUInteger line;
|
||||
@property (nonatomic, readonly, copy) NSString * __nonnull description;
|
||||
@end
|
||||
|
||||
#pragma clang diagnostic pop
|
||||
-6
@@ -1,6 +0,0 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <Nimble/NMBExceptionCapture.h>
|
||||
#import <Nimble/DSL.h>
|
||||
|
||||
FOUNDATION_EXPORT double NimbleVersionNumber;
|
||||
FOUNDATION_EXPORT const unsigned char NimbleVersionString[];
|
||||
Generated
Vendored
BIN
Binary file not shown.
Generated
Vendored
BIN
Binary file not shown.
-10
@@ -1,10 +0,0 @@
|
||||
framework module Nimble {
|
||||
umbrella header "Nimble.h"
|
||||
|
||||
export *
|
||||
module * { export * }
|
||||
}
|
||||
|
||||
module Nimble.Swift {
|
||||
header "Nimble-Swift.h"
|
||||
}
|
||||
BIN
Binary file not shown.
-51
@@ -1,51 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>BuildMachineOSBuild</key>
|
||||
<string>14F27</string>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>Nimble</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>net.jeffhui.Nimble</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>Nimble</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleSupportedPlatforms</key>
|
||||
<array>
|
||||
<string>MacOSX</string>
|
||||
</array>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1</string>
|
||||
<key>DTCompiler</key>
|
||||
<string>com.apple.compilers.llvm.clang.1_0</string>
|
||||
<key>DTPlatformBuild</key>
|
||||
<string>7A192o</string>
|
||||
<key>DTPlatformVersion</key>
|
||||
<string>GM</string>
|
||||
<key>DTSDKBuild</key>
|
||||
<string>15A244e</string>
|
||||
<key>DTSDKName</key>
|
||||
<string>macosx10.11</string>
|
||||
<key>DTXcode</key>
|
||||
<string>0700</string>
|
||||
<key>DTXcodeBuild</key>
|
||||
<string>7A192o</string>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
<string>Copyright © 2014 Jeff Hui. All rights reserved.</string>
|
||||
<key>UIDeviceFamily</key>
|
||||
<array>
|
||||
<integer>1</integer>
|
||||
<integer>2</integer>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
||||
-1
@@ -1 +0,0 @@
|
||||
A
|
||||
-20
@@ -1,20 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>English</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.apple.xcode.dsym.net.jeffhui.Nimble</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>dSYM</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1</string>
|
||||
</dict>
|
||||
</plist>
|
||||
BIN
Binary file not shown.
-129
@@ -1,129 +0,0 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@class NMBExpectation;
|
||||
@class NMBObjCBeCloseToMatcher;
|
||||
@class NMBObjCRaiseExceptionMatcher;
|
||||
@protocol NMBMatcher;
|
||||
|
||||
|
||||
#define NIMBLE_EXPORT FOUNDATION_EXPORT
|
||||
|
||||
#ifdef NIMBLE_DISABLE_SHORT_SYNTAX
|
||||
#define NIMBLE_SHORT(PROTO, ORIGINAL)
|
||||
#else
|
||||
#define NIMBLE_SHORT(PROTO, ORIGINAL) FOUNDATION_STATIC_INLINE PROTO { return (ORIGINAL); }
|
||||
#endif
|
||||
|
||||
NIMBLE_EXPORT NMBExpectation *NMB_expect(id(^actualBlock)(), NSString *file, NSUInteger line);
|
||||
NIMBLE_EXPORT NMBExpectation *NMB_expectAction(void(^actualBlock)(), NSString *file, NSUInteger line);
|
||||
|
||||
NIMBLE_EXPORT id<NMBMatcher> NMB_equal(id expectedValue);
|
||||
NIMBLE_SHORT(id<NMBMatcher> equal(id expectedValue),
|
||||
NMB_equal(expectedValue));
|
||||
|
||||
NIMBLE_EXPORT NMBObjCBeCloseToMatcher *NMB_beCloseTo(NSNumber *expectedValue);
|
||||
NIMBLE_SHORT(NMBObjCBeCloseToMatcher *beCloseTo(id expectedValue),
|
||||
NMB_beCloseTo(expectedValue));
|
||||
|
||||
NIMBLE_EXPORT id<NMBMatcher> NMB_beAnInstanceOf(Class expectedClass);
|
||||
NIMBLE_SHORT(id<NMBMatcher> beAnInstanceOf(Class expectedClass),
|
||||
NMB_beAnInstanceOf(expectedClass));
|
||||
|
||||
NIMBLE_EXPORT id<NMBMatcher> NMB_beAKindOf(Class expectedClass);
|
||||
NIMBLE_SHORT(id<NMBMatcher> beAKindOf(Class expectedClass),
|
||||
NMB_beAKindOf(expectedClass));
|
||||
|
||||
NIMBLE_EXPORT id<NMBMatcher> NMB_beginWith(id itemElementOrSubstring);
|
||||
NIMBLE_SHORT(id<NMBMatcher> beginWith(id itemElementOrSubstring),
|
||||
NMB_beginWith(itemElementOrSubstring));
|
||||
|
||||
NIMBLE_EXPORT id<NMBMatcher> NMB_beGreaterThan(NSNumber *expectedValue);
|
||||
NIMBLE_SHORT(id<NMBMatcher> beGreaterThan(NSNumber *expectedValue),
|
||||
NMB_beGreaterThan(expectedValue));
|
||||
|
||||
NIMBLE_EXPORT id<NMBMatcher> NMB_beGreaterThanOrEqualTo(NSNumber *expectedValue);
|
||||
NIMBLE_SHORT(id<NMBMatcher> beGreaterThanOrEqualTo(NSNumber *expectedValue),
|
||||
NMB_beGreaterThanOrEqualTo(expectedValue));
|
||||
|
||||
NIMBLE_EXPORT id<NMBMatcher> NMB_beIdenticalTo(id expectedInstance);
|
||||
NIMBLE_SHORT(id<NMBMatcher> beIdenticalTo(id expectedInstance),
|
||||
NMB_beIdenticalTo(expectedInstance));
|
||||
|
||||
NIMBLE_EXPORT id<NMBMatcher> NMB_beLessThan(NSNumber *expectedValue);
|
||||
NIMBLE_SHORT(id<NMBMatcher> beLessThan(NSNumber *expectedValue),
|
||||
NMB_beLessThan(expectedValue));
|
||||
|
||||
NIMBLE_EXPORT id<NMBMatcher> NMB_beLessThanOrEqualTo(NSNumber *expectedValue);
|
||||
NIMBLE_SHORT(id<NMBMatcher> beLessThanOrEqualTo(NSNumber *expectedValue),
|
||||
NMB_beLessThanOrEqualTo(expectedValue));
|
||||
|
||||
NIMBLE_EXPORT id<NMBMatcher> NMB_beTruthy(void);
|
||||
NIMBLE_SHORT(id<NMBMatcher> beTruthy(void),
|
||||
NMB_beTruthy());
|
||||
|
||||
NIMBLE_EXPORT id<NMBMatcher> NMB_beFalsy(void);
|
||||
NIMBLE_SHORT(id<NMBMatcher> beFalsy(void),
|
||||
NMB_beFalsy());
|
||||
|
||||
NIMBLE_EXPORT id<NMBMatcher> NMB_beTrue(void);
|
||||
NIMBLE_SHORT(id<NMBMatcher> beTrue(void),
|
||||
NMB_beTrue());
|
||||
|
||||
NIMBLE_EXPORT id<NMBMatcher> NMB_beFalse(void);
|
||||
NIMBLE_SHORT(id<NMBMatcher> beFalse(void),
|
||||
NMB_beFalse());
|
||||
|
||||
NIMBLE_EXPORT id<NMBMatcher> NMB_beNil(void);
|
||||
NIMBLE_SHORT(id<NMBMatcher> beNil(void),
|
||||
NMB_beNil());
|
||||
|
||||
NIMBLE_EXPORT id<NMBMatcher> NMB_beEmpty(void);
|
||||
NIMBLE_SHORT(id<NMBMatcher> beEmpty(void),
|
||||
NMB_beEmpty());
|
||||
|
||||
NIMBLE_EXPORT id<NMBMatcher> NMB_containWithNilTermination(id itemOrSubstring, ...) NS_REQUIRES_NIL_TERMINATION;
|
||||
#define NMB_contain(...) NMB_containWithNilTermination(__VA_ARGS__, nil)
|
||||
#ifndef NIMBLE_DISABLE_SHORT_SYNTAX
|
||||
#define contain(...) NMB_contain(__VA_ARGS__)
|
||||
#endif
|
||||
|
||||
NIMBLE_EXPORT id<NMBMatcher> NMB_endWith(id itemElementOrSubstring);
|
||||
NIMBLE_SHORT(id<NMBMatcher> endWith(id itemElementOrSubstring),
|
||||
NMB_endWith(itemElementOrSubstring));
|
||||
|
||||
NIMBLE_EXPORT NMBObjCRaiseExceptionMatcher *NMB_raiseException(void);
|
||||
NIMBLE_SHORT(NMBObjCRaiseExceptionMatcher *raiseException(void),
|
||||
NMB_raiseException());
|
||||
|
||||
NIMBLE_EXPORT id<NMBMatcher> NMB_match(id expectedValue);
|
||||
NIMBLE_SHORT(id<NMBMatcher> match(id expectedValue),
|
||||
NMB_match(expectedValue));
|
||||
|
||||
NIMBLE_EXPORT id<NMBMatcher> NMB_allPass(id matcher);
|
||||
NIMBLE_SHORT(id<NMBMatcher> allPass(id matcher),
|
||||
NMB_allPass(matcher));
|
||||
|
||||
// In order to preserve breakpoint behavior despite using macros to fill in __FILE__ and __LINE__,
|
||||
// define a builder that populates __FILE__ and __LINE__, and returns a block that takes timeout
|
||||
// and action arguments. See https://github.com/Quick/Quick/pull/185 for details.
|
||||
typedef void (^NMBWaitUntilTimeoutBlock)(NSTimeInterval timeout, void (^action)(void (^)(void)));
|
||||
typedef void (^NMBWaitUntilBlock)(void (^action)(void (^)(void)));
|
||||
|
||||
NIMBLE_EXPORT NMBWaitUntilTimeoutBlock NMB_waitUntilTimeoutBuilder(NSString *file, NSUInteger line);
|
||||
NIMBLE_EXPORT NMBWaitUntilBlock NMB_waitUntilBuilder(NSString *file, NSUInteger line);
|
||||
|
||||
NIMBLE_EXPORT void NMB_failWithMessage(NSString *msg, NSString *file, NSUInteger line);
|
||||
|
||||
#define NMB_waitUntilTimeout NMB_waitUntilTimeoutBuilder(@(__FILE__), __LINE__)
|
||||
#define NMB_waitUntil NMB_waitUntilBuilder(@(__FILE__), __LINE__)
|
||||
|
||||
#ifndef NIMBLE_DISABLE_SHORT_SYNTAX
|
||||
#define expect(...) NMB_expect(^id{ return (__VA_ARGS__); }, @(__FILE__), __LINE__)
|
||||
#define expectAction(BLOCK) NMB_expectAction((BLOCK), @(__FILE__), __LINE__)
|
||||
#define failWithMessage(msg) NMB_failWithMessage(msg, @(__FILE__), __LINE__)
|
||||
#define fail() failWithMessage(@"fail() always fails")
|
||||
|
||||
|
||||
#define waitUntilTimeout NMB_waitUntilTimeout
|
||||
#define waitUntil NMB_waitUntil
|
||||
#endif
|
||||
-8
@@ -1,8 +0,0 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface NMBExceptionCapture : NSObject
|
||||
|
||||
- (id)initWithHandler:(void(^)(NSException *))handler finally:(void(^)())finally;
|
||||
- (void)tryBlock:(void(^)())unsafeBlock;
|
||||
|
||||
@end
|
||||
-364
@@ -1,364 +0,0 @@
|
||||
// Generated by Apple Swift version 2.0 (swiftlang-700.0.57.3 clang-700.0.72)
|
||||
#pragma clang diagnostic push
|
||||
|
||||
#if defined(__has_include) && __has_include(<swift/objc-prologue.h>)
|
||||
# include <swift/objc-prologue.h>
|
||||
#endif
|
||||
|
||||
#pragma clang diagnostic ignored "-Wauto-import"
|
||||
#include <objc/NSObject.h>
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#if defined(__has_include) && __has_include(<uchar.h>)
|
||||
# include <uchar.h>
|
||||
#elif !defined(__cplusplus) || __cplusplus < 201103L
|
||||
typedef uint_least16_t char16_t;
|
||||
typedef uint_least32_t char32_t;
|
||||
#endif
|
||||
|
||||
typedef struct _NSZone NSZone;
|
||||
|
||||
#if !defined(SWIFT_PASTE)
|
||||
# define SWIFT_PASTE_HELPER(x, y) x##y
|
||||
# define SWIFT_PASTE(x, y) SWIFT_PASTE_HELPER(x, y)
|
||||
#endif
|
||||
#if !defined(SWIFT_METATYPE)
|
||||
# define SWIFT_METATYPE(X) Class
|
||||
#endif
|
||||
|
||||
#if defined(__has_attribute) && __has_attribute(objc_runtime_name)
|
||||
# define SWIFT_RUNTIME_NAME(X) __attribute__((objc_runtime_name(X)))
|
||||
#else
|
||||
# define SWIFT_RUNTIME_NAME(X)
|
||||
#endif
|
||||
#if defined(__has_attribute) && __has_attribute(swift_name)
|
||||
# define SWIFT_COMPILE_NAME(X) __attribute__((swift_name(X)))
|
||||
#else
|
||||
# define SWIFT_COMPILE_NAME(X)
|
||||
#endif
|
||||
#if !defined(SWIFT_CLASS_EXTRA)
|
||||
# define SWIFT_CLASS_EXTRA
|
||||
#endif
|
||||
#if !defined(SWIFT_PROTOCOL_EXTRA)
|
||||
# define SWIFT_PROTOCOL_EXTRA
|
||||
#endif
|
||||
#if !defined(SWIFT_ENUM_EXTRA)
|
||||
# define SWIFT_ENUM_EXTRA
|
||||
#endif
|
||||
#if !defined(SWIFT_CLASS)
|
||||
# if defined(__has_attribute) && __has_attribute(objc_subclassing_restricted)
|
||||
# define SWIFT_CLASS(SWIFT_NAME) SWIFT_RUNTIME_NAME(SWIFT_NAME) __attribute__((objc_subclassing_restricted)) SWIFT_CLASS_EXTRA
|
||||
# define SWIFT_CLASS_NAMED(SWIFT_NAME) __attribute__((objc_subclassing_restricted)) SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_CLASS_EXTRA
|
||||
# else
|
||||
# define SWIFT_CLASS(SWIFT_NAME) SWIFT_RUNTIME_NAME(SWIFT_NAME) SWIFT_CLASS_EXTRA
|
||||
# define SWIFT_CLASS_NAMED(SWIFT_NAME) SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_CLASS_EXTRA
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if !defined(SWIFT_PROTOCOL)
|
||||
# define SWIFT_PROTOCOL(SWIFT_NAME) SWIFT_RUNTIME_NAME(SWIFT_NAME) SWIFT_PROTOCOL_EXTRA
|
||||
# define SWIFT_PROTOCOL_NAMED(SWIFT_NAME) SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_PROTOCOL_EXTRA
|
||||
#endif
|
||||
|
||||
#if !defined(SWIFT_EXTENSION)
|
||||
# define SWIFT_EXTENSION(M) SWIFT_PASTE(M##_Swift_, __LINE__)
|
||||
#endif
|
||||
|
||||
#if !defined(OBJC_DESIGNATED_INITIALIZER)
|
||||
# if defined(__has_attribute) && __has_attribute(objc_designated_initializer)
|
||||
# define OBJC_DESIGNATED_INITIALIZER __attribute__((objc_designated_initializer))
|
||||
# else
|
||||
# define OBJC_DESIGNATED_INITIALIZER
|
||||
# endif
|
||||
#endif
|
||||
#if !defined(SWIFT_ENUM)
|
||||
# define SWIFT_ENUM(_type, _name) enum _name : _type _name; enum SWIFT_ENUM_EXTRA _name : _type
|
||||
#endif
|
||||
typedef float swift_float2 __attribute__((__ext_vector_type__(2)));
|
||||
typedef float swift_float3 __attribute__((__ext_vector_type__(3)));
|
||||
typedef float swift_float4 __attribute__((__ext_vector_type__(4)));
|
||||
typedef double swift_double2 __attribute__((__ext_vector_type__(2)));
|
||||
typedef double swift_double3 __attribute__((__ext_vector_type__(3)));
|
||||
typedef double swift_double4 __attribute__((__ext_vector_type__(4)));
|
||||
typedef int swift_int2 __attribute__((__ext_vector_type__(2)));
|
||||
typedef int swift_int3 __attribute__((__ext_vector_type__(3)));
|
||||
typedef int swift_int4 __attribute__((__ext_vector_type__(4)));
|
||||
#if defined(__has_feature) && __has_feature(modules)
|
||||
@import ObjectiveC;
|
||||
@import Foundation;
|
||||
#endif
|
||||
|
||||
#pragma clang diagnostic ignored "-Wproperty-attribute-mismatch"
|
||||
#pragma clang diagnostic ignored "-Wduplicate-method-arg"
|
||||
|
||||
|
||||
/// Encapsulates the failure message that matchers can report to the end user.
|
||||
///
|
||||
/// This is shared state between Nimble and matchers that mutate this value.
|
||||
SWIFT_CLASS("_TtC6Nimble14FailureMessage")
|
||||
@interface FailureMessage : NSObject
|
||||
@property (nonatomic, copy) NSString * __nonnull expected;
|
||||
@property (nonatomic, copy) NSString * __nullable actualValue;
|
||||
@property (nonatomic, copy) NSString * __nonnull to;
|
||||
@property (nonatomic, copy) NSString * __nonnull postfixMessage;
|
||||
@property (nonatomic, copy) NSString * __nonnull postfixActual;
|
||||
@property (nonatomic, copy) NSString * __nullable userDescription;
|
||||
@property (nonatomic, copy) NSString * __nonnull stringValue;
|
||||
- (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER;
|
||||
- (nonnull instancetype)initWithStringValue:(NSString * __nonnull)stringValue OBJC_DESIGNATED_INITIALIZER;
|
||||
@end
|
||||
|
||||
|
||||
|
||||
/// Protocol for types that support only beEmpty()
|
||||
SWIFT_PROTOCOL("_TtP6Nimble13NMBCollection_")
|
||||
@protocol NMBCollection
|
||||
@property (nonatomic, readonly) NSInteger count;
|
||||
@end
|
||||
|
||||
|
||||
|
||||
/// Protocol for types to support beLessThan(), beLessThanOrEqualTo(), beGreaterThan(), beGreaterThanOrEqualTo(), and equal() matchers.
|
||||
///
|
||||
/// Types that conform to Swift's Comparable protocol will work implicitly too
|
||||
SWIFT_PROTOCOL("_TtP6Nimble13NMBComparable_")
|
||||
@protocol NMBComparable
|
||||
- (NSComparisonResult)NMB_compare:(id <NMBComparable> __null_unspecified)otherObject;
|
||||
@end
|
||||
|
||||
|
||||
|
||||
/// Protocol for types that support contain() matcher.
|
||||
SWIFT_PROTOCOL("_TtP6Nimble12NMBContainer_")
|
||||
@protocol NMBContainer
|
||||
- (BOOL)containsObject:(id __null_unspecified)object;
|
||||
@end
|
||||
|
||||
|
||||
|
||||
/// Protocol for types to support beCloseTo() matcher
|
||||
SWIFT_PROTOCOL("_TtP6Nimble20NMBDoubleConvertible_")
|
||||
@protocol NMBDoubleConvertible
|
||||
@property (nonatomic, readonly) double doubleValue;
|
||||
@end
|
||||
|
||||
@protocol NMBMatcher;
|
||||
|
||||
SWIFT_CLASS("_TtC6Nimble14NMBExpectation")
|
||||
@interface NMBExpectation : NSObject
|
||||
- (nonnull instancetype)initWithActualBlock:(NSObject * __null_unspecified (^ __nonnull)(void))actualBlock negative:(BOOL)negative file:(NSString * __nonnull)file line:(NSUInteger)line OBJC_DESIGNATED_INITIALIZER;
|
||||
@property (nonatomic, readonly, copy) NMBExpectation * __nonnull (^ __nonnull withTimeout)(NSTimeInterval);
|
||||
@property (nonatomic, readonly, copy) void (^ __nonnull to)(id <NMBMatcher> __nonnull);
|
||||
@property (nonatomic, readonly, copy) void (^ __nonnull toWithDescription)(id <NMBMatcher> __nonnull, NSString * __nonnull);
|
||||
@property (nonatomic, readonly, copy) void (^ __nonnull toNot)(id <NMBMatcher> __nonnull);
|
||||
@property (nonatomic, readonly, copy) void (^ __nonnull toNotWithDescription)(id <NMBMatcher> __nonnull, NSString * __nonnull);
|
||||
@property (nonatomic, readonly, copy) void (^ __nonnull notTo)(id <NMBMatcher> __nonnull);
|
||||
@property (nonatomic, readonly, copy) void (^ __nonnull notToWithDescription)(id <NMBMatcher> __nonnull, NSString * __nonnull);
|
||||
@property (nonatomic, readonly, copy) void (^ __nonnull toEventually)(id <NMBMatcher> __nonnull);
|
||||
@property (nonatomic, readonly, copy) void (^ __nonnull toEventuallyWithDescription)(id <NMBMatcher> __nonnull, NSString * __nonnull);
|
||||
@property (nonatomic, readonly, copy) void (^ __nonnull toEventuallyNot)(id <NMBMatcher> __nonnull);
|
||||
@property (nonatomic, readonly, copy) void (^ __nonnull toEventuallyNotWithDescription)(id <NMBMatcher> __nonnull, NSString * __nonnull);
|
||||
@property (nonatomic, readonly, copy) void (^ __nonnull toNotEventually)(id <NMBMatcher> __nonnull);
|
||||
@property (nonatomic, readonly, copy) void (^ __nonnull toNotEventuallyWithDescription)(id <NMBMatcher> __nonnull, NSString * __nonnull);
|
||||
+ (void)failWithMessage:(NSString * __nonnull)message file:(NSString * __nonnull)file line:(NSUInteger)line;
|
||||
@end
|
||||
|
||||
@class SourceLocation;
|
||||
|
||||
|
||||
/// Objective-C interface to the Swift variant of Matcher.
|
||||
SWIFT_PROTOCOL("_TtP6Nimble10NMBMatcher_")
|
||||
@protocol NMBMatcher
|
||||
- (BOOL)matches:(NSObject * __null_unspecified (^ __nonnull)(void))actualBlock failureMessage:(FailureMessage * __nonnull)failureMessage location:(SourceLocation * __nonnull)location;
|
||||
- (BOOL)doesNotMatch:(NSObject * __null_unspecified (^ __nonnull)(void))actualBlock failureMessage:(FailureMessage * __nonnull)failureMessage location:(SourceLocation * __nonnull)location;
|
||||
@end
|
||||
|
||||
|
||||
SWIFT_CLASS("_TtC6Nimble23NMBObjCBeCloseToMatcher")
|
||||
@interface NMBObjCBeCloseToMatcher : NSObject <NMBMatcher>
|
||||
- (BOOL)matches:(NSObject * __null_unspecified (^ __nonnull)(void))actualExpression failureMessage:(FailureMessage * __nonnull)failureMessage location:(SourceLocation * __nonnull)location;
|
||||
- (BOOL)doesNotMatch:(NSObject * __null_unspecified (^ __nonnull)(void))actualExpression failureMessage:(FailureMessage * __nonnull)failureMessage location:(SourceLocation * __nonnull)location;
|
||||
@property (nonatomic, readonly, copy) NMBObjCBeCloseToMatcher * __nonnull (^ __nonnull within)(double);
|
||||
@end
|
||||
|
||||
|
||||
SWIFT_CLASS("_TtC6Nimble14NMBObjCMatcher")
|
||||
@interface NMBObjCMatcher : NSObject <NMBMatcher>
|
||||
- (BOOL)matches:(NSObject * __null_unspecified (^ __nonnull)(void))actualBlock failureMessage:(FailureMessage * __nonnull)failureMessage location:(SourceLocation * __nonnull)location;
|
||||
- (BOOL)doesNotMatch:(NSObject * __null_unspecified (^ __nonnull)(void))actualBlock failureMessage:(FailureMessage * __nonnull)failureMessage location:(SourceLocation * __nonnull)location;
|
||||
@end
|
||||
|
||||
|
||||
@interface NMBObjCMatcher (SWIFT_EXTENSION(Nimble))
|
||||
+ (NMBObjCMatcher * __nonnull)beEmptyMatcher;
|
||||
@end
|
||||
|
||||
|
||||
@interface NMBObjCMatcher (SWIFT_EXTENSION(Nimble))
|
||||
+ (NMBObjCMatcher * __nonnull)beIdenticalToMatcher:(NSObject * __nullable)expected;
|
||||
@end
|
||||
|
||||
|
||||
@interface NMBObjCMatcher (SWIFT_EXTENSION(Nimble))
|
||||
+ (NMBObjCMatcher * __nonnull)beginWithMatcher:(id __nonnull)expected;
|
||||
@end
|
||||
|
||||
|
||||
@interface NMBObjCMatcher (SWIFT_EXTENSION(Nimble))
|
||||
+ (NMBObjCMatcher * __nonnull)beGreaterThanOrEqualToMatcher:(id <NMBComparable> __nullable)expected;
|
||||
@end
|
||||
|
||||
|
||||
@interface NMBObjCMatcher (SWIFT_EXTENSION(Nimble))
|
||||
+ (NMBObjCMatcher * __nonnull)containMatcher:(NSArray<NSObject *> * __nonnull)expected;
|
||||
@end
|
||||
|
||||
|
||||
@interface NMBObjCMatcher (SWIFT_EXTENSION(Nimble))
|
||||
+ (NMBObjCMatcher * __nonnull)beGreaterThanMatcher:(id <NMBComparable> __nullable)expected;
|
||||
@end
|
||||
|
||||
|
||||
@interface NMBObjCMatcher (SWIFT_EXTENSION(Nimble))
|
||||
+ (NMBObjCMatcher * __nonnull)beLessThanMatcher:(id <NMBComparable> __nullable)expected;
|
||||
@end
|
||||
|
||||
|
||||
@interface NMBObjCMatcher (SWIFT_EXTENSION(Nimble))
|
||||
+ (id <NMBMatcher> __nonnull)equalMatcher:(NSObject * __nonnull)expected;
|
||||
@end
|
||||
|
||||
@class NSString;
|
||||
|
||||
@interface NMBObjCMatcher (SWIFT_EXTENSION(Nimble))
|
||||
+ (id <NMBMatcher> __nonnull)matchMatcher:(NSString * __nonnull)expected;
|
||||
@end
|
||||
|
||||
|
||||
@interface NMBObjCMatcher (SWIFT_EXTENSION(Nimble))
|
||||
+ (id <NMBMatcher> __nonnull)beAKindOfMatcher:(Class __nonnull)expected;
|
||||
@end
|
||||
|
||||
|
||||
@interface NMBObjCMatcher (SWIFT_EXTENSION(Nimble))
|
||||
+ (NMBObjCMatcher * __nonnull)allPassMatcher:(NMBObjCMatcher * __nonnull)matcher;
|
||||
@end
|
||||
|
||||
|
||||
@interface NMBObjCMatcher (SWIFT_EXTENSION(Nimble))
|
||||
+ (id <NMBMatcher> __nonnull)beAnInstanceOfMatcher:(Class __nonnull)expected;
|
||||
@end
|
||||
|
||||
|
||||
@interface NMBObjCMatcher (SWIFT_EXTENSION(Nimble))
|
||||
+ (NMBObjCMatcher * __nonnull)beLessThanOrEqualToMatcher:(id <NMBComparable> __nullable)expected;
|
||||
@end
|
||||
|
||||
@class NSNumber;
|
||||
|
||||
@interface NMBObjCMatcher (SWIFT_EXTENSION(Nimble))
|
||||
+ (NMBObjCBeCloseToMatcher * __nonnull)beCloseToMatcher:(NSNumber * __nonnull)expected within:(double)within;
|
||||
@end
|
||||
|
||||
@class NMBObjCRaiseExceptionMatcher;
|
||||
|
||||
@interface NMBObjCMatcher (SWIFT_EXTENSION(Nimble))
|
||||
+ (NMBObjCRaiseExceptionMatcher * __nonnull)raiseExceptionMatcher;
|
||||
@end
|
||||
|
||||
|
||||
@interface NMBObjCMatcher (SWIFT_EXTENSION(Nimble))
|
||||
+ (NMBObjCMatcher * __nonnull)endWithMatcher:(id __nonnull)expected;
|
||||
@end
|
||||
|
||||
|
||||
@interface NMBObjCMatcher (SWIFT_EXTENSION(Nimble))
|
||||
+ (NMBObjCMatcher * __nonnull)beNilMatcher;
|
||||
@end
|
||||
|
||||
|
||||
@interface NMBObjCMatcher (SWIFT_EXTENSION(Nimble))
|
||||
+ (NMBObjCMatcher * __nonnull)beTruthyMatcher;
|
||||
+ (NMBObjCMatcher * __nonnull)beFalsyMatcher;
|
||||
+ (NMBObjCMatcher * __nonnull)beTrueMatcher;
|
||||
+ (NMBObjCMatcher * __nonnull)beFalseMatcher;
|
||||
@end
|
||||
|
||||
@class NSDictionary;
|
||||
@class NSException;
|
||||
|
||||
SWIFT_CLASS("_TtC6Nimble28NMBObjCRaiseExceptionMatcher")
|
||||
@interface NMBObjCRaiseExceptionMatcher : NSObject <NMBMatcher>
|
||||
- (BOOL)matches:(NSObject * __null_unspecified (^ __nonnull)(void))actualBlock failureMessage:(FailureMessage * __nonnull)failureMessage location:(SourceLocation * __nonnull)location;
|
||||
- (BOOL)doesNotMatch:(NSObject * __null_unspecified (^ __nonnull)(void))actualBlock failureMessage:(FailureMessage * __nonnull)failureMessage location:(SourceLocation * __nonnull)location;
|
||||
@property (nonatomic, readonly, copy) NMBObjCRaiseExceptionMatcher * __nonnull (^ __nonnull named)(NSString * __nonnull);
|
||||
@property (nonatomic, readonly, copy) NMBObjCRaiseExceptionMatcher * __nonnull (^ __nonnull reason)(NSString * __nullable);
|
||||
@property (nonatomic, readonly, copy) NMBObjCRaiseExceptionMatcher * __nonnull (^ __nonnull userInfo)(NSDictionary * __nullable);
|
||||
@property (nonatomic, readonly, copy) NMBObjCRaiseExceptionMatcher * __nonnull (^ __nonnull satisfyingBlock)(void (^ __nullable)(NSException * __nonnull));
|
||||
@end
|
||||
|
||||
|
||||
|
||||
/// Protocol for types that support beginWith(), endWith(), beEmpty() matchers
|
||||
SWIFT_PROTOCOL("_TtP6Nimble20NMBOrderedCollection_")
|
||||
@protocol NMBOrderedCollection <NMBCollection>
|
||||
- (NSInteger)indexOfObject:(id __null_unspecified)object;
|
||||
@end
|
||||
|
||||
|
||||
@interface NSArray (SWIFT_EXTENSION(Nimble)) <NMBContainer>
|
||||
@end
|
||||
|
||||
|
||||
@interface NSArray (SWIFT_EXTENSION(Nimble)) <NMBOrderedCollection, NMBCollection>
|
||||
@end
|
||||
|
||||
|
||||
@interface NSArray (SWIFT_EXTENSION(Nimble))
|
||||
@end
|
||||
|
||||
|
||||
@interface NSDictionary (SWIFT_EXTENSION(Nimble)) <NMBCollection>
|
||||
@end
|
||||
|
||||
|
||||
@interface NSHashTable (SWIFT_EXTENSION(Nimble)) <NMBContainer>
|
||||
@end
|
||||
|
||||
|
||||
@interface NSHashTable (SWIFT_EXTENSION(Nimble)) <NMBCollection>
|
||||
@end
|
||||
|
||||
|
||||
@interface NSNumber (SWIFT_EXTENSION(Nimble)) <NMBDoubleConvertible>
|
||||
@end
|
||||
|
||||
|
||||
@interface NSNumber (SWIFT_EXTENSION(Nimble)) <NMBComparable>
|
||||
- (NSComparisonResult)NMB_compare:(id <NMBComparable> __null_unspecified)otherObject;
|
||||
@end
|
||||
|
||||
|
||||
@interface NSSet (SWIFT_EXTENSION(Nimble)) <NMBCollection>
|
||||
@end
|
||||
|
||||
|
||||
@interface NSSet (SWIFT_EXTENSION(Nimble)) <NMBContainer>
|
||||
@end
|
||||
|
||||
|
||||
@interface NSString (SWIFT_EXTENSION(Nimble)) <NMBComparable>
|
||||
- (NSComparisonResult)NMB_compare:(id <NMBComparable> __null_unspecified)otherObject;
|
||||
@end
|
||||
|
||||
|
||||
SWIFT_CLASS("_TtC6Nimble14SourceLocation")
|
||||
@interface SourceLocation : NSObject
|
||||
@property (nonatomic, readonly, copy) NSString * __nonnull file;
|
||||
@property (nonatomic, readonly) NSUInteger line;
|
||||
@property (nonatomic, readonly, copy) NSString * __nonnull description;
|
||||
@end
|
||||
|
||||
#pragma clang diagnostic pop
|
||||
-6
@@ -1,6 +0,0 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <Nimble/NMBExceptionCapture.h>
|
||||
#import <Nimble/DSL.h>
|
||||
|
||||
FOUNDATION_EXPORT double NimbleVersionNumber;
|
||||
FOUNDATION_EXPORT const unsigned char NimbleVersionString[];
|
||||
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Generated
Vendored
BIN
Binary file not shown.
-10
@@ -1,10 +0,0 @@
|
||||
framework module Nimble {
|
||||
umbrella header "Nimble.h"
|
||||
|
||||
export *
|
||||
module * { export * }
|
||||
}
|
||||
|
||||
module Nimble.Swift {
|
||||
header "Nimble-Swift.h"
|
||||
}
|
||||
BIN
Binary file not shown.
-183
@@ -1,183 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>files</key>
|
||||
<dict>
|
||||
<key>Headers/DSL.h</key>
|
||||
<data>
|
||||
auYzCIxlY2jTkyI1BlljW3KUTJY=
|
||||
</data>
|
||||
<key>Headers/NMBExceptionCapture.h</key>
|
||||
<data>
|
||||
ncXv+PqMUjLHOJpiFz6BKmTAq5o=
|
||||
</data>
|
||||
<key>Headers/Nimble-Swift.h</key>
|
||||
<data>
|
||||
ix7zUf4GFfA4sevTnSKvAsAN3xM=
|
||||
</data>
|
||||
<key>Headers/Nimble.h</key>
|
||||
<data>
|
||||
HXkPd6XbqY7QmdFCpOCNIHhI4v0=
|
||||
</data>
|
||||
<key>Info.plist</key>
|
||||
<data>
|
||||
m9rBh3svN6G89okFeorwD5OH+2g=
|
||||
</data>
|
||||
<key>Modules/Nimble.swiftmodule/arm.swiftdoc</key>
|
||||
<data>
|
||||
lSaVfyH8XbRz0WDbmqKJxc5QtbY=
|
||||
</data>
|
||||
<key>Modules/Nimble.swiftmodule/arm.swiftmodule</key>
|
||||
<data>
|
||||
NseDOVaErTA347+6KjeL5eI3+kI=
|
||||
</data>
|
||||
<key>Modules/Nimble.swiftmodule/arm64.swiftdoc</key>
|
||||
<data>
|
||||
6W52hA33Ca+9qq8Yiql4aY8+0Rk=
|
||||
</data>
|
||||
<key>Modules/Nimble.swiftmodule/arm64.swiftmodule</key>
|
||||
<data>
|
||||
Yn3aQiLuskjb8JCg2+JAqYVrN/Y=
|
||||
</data>
|
||||
<key>Modules/module.modulemap</key>
|
||||
<data>
|
||||
HraXvk1VTxnsGdY8oSlKGNkdg60=
|
||||
</data>
|
||||
</dict>
|
||||
<key>files2</key>
|
||||
<dict>
|
||||
<key>Headers/DSL.h</key>
|
||||
<data>
|
||||
auYzCIxlY2jTkyI1BlljW3KUTJY=
|
||||
</data>
|
||||
<key>Headers/NMBExceptionCapture.h</key>
|
||||
<data>
|
||||
ncXv+PqMUjLHOJpiFz6BKmTAq5o=
|
||||
</data>
|
||||
<key>Headers/Nimble-Swift.h</key>
|
||||
<data>
|
||||
ix7zUf4GFfA4sevTnSKvAsAN3xM=
|
||||
</data>
|
||||
<key>Headers/Nimble.h</key>
|
||||
<data>
|
||||
HXkPd6XbqY7QmdFCpOCNIHhI4v0=
|
||||
</data>
|
||||
<key>Modules/Nimble.swiftmodule/arm.swiftdoc</key>
|
||||
<data>
|
||||
lSaVfyH8XbRz0WDbmqKJxc5QtbY=
|
||||
</data>
|
||||
<key>Modules/Nimble.swiftmodule/arm.swiftmodule</key>
|
||||
<data>
|
||||
NseDOVaErTA347+6KjeL5eI3+kI=
|
||||
</data>
|
||||
<key>Modules/Nimble.swiftmodule/arm64.swiftdoc</key>
|
||||
<data>
|
||||
6W52hA33Ca+9qq8Yiql4aY8+0Rk=
|
||||
</data>
|
||||
<key>Modules/Nimble.swiftmodule/arm64.swiftmodule</key>
|
||||
<data>
|
||||
Yn3aQiLuskjb8JCg2+JAqYVrN/Y=
|
||||
</data>
|
||||
<key>Modules/module.modulemap</key>
|
||||
<data>
|
||||
HraXvk1VTxnsGdY8oSlKGNkdg60=
|
||||
</data>
|
||||
</dict>
|
||||
<key>rules</key>
|
||||
<dict>
|
||||
<key>^</key>
|
||||
<true/>
|
||||
<key>^.*\.lproj/</key>
|
||||
<dict>
|
||||
<key>optional</key>
|
||||
<true/>
|
||||
<key>weight</key>
|
||||
<real>1000</real>
|
||||
</dict>
|
||||
<key>^.*\.lproj/locversion.plist$</key>
|
||||
<dict>
|
||||
<key>omit</key>
|
||||
<true/>
|
||||
<key>weight</key>
|
||||
<real>1100</real>
|
||||
</dict>
|
||||
<key>^version.plist$</key>
|
||||
<true/>
|
||||
</dict>
|
||||
<key>rules2</key>
|
||||
<dict>
|
||||
<key>.*\.dSYM($|/)</key>
|
||||
<dict>
|
||||
<key>weight</key>
|
||||
<real>11</real>
|
||||
</dict>
|
||||
<key>^</key>
|
||||
<dict>
|
||||
<key>weight</key>
|
||||
<real>20</real>
|
||||
</dict>
|
||||
<key>^(.*/)?\.DS_Store$</key>
|
||||
<dict>
|
||||
<key>omit</key>
|
||||
<true/>
|
||||
<key>weight</key>
|
||||
<real>2000</real>
|
||||
</dict>
|
||||
<key>^(Frameworks|SharedFrameworks|PlugIns|Plug-ins|XPCServices|Helpers|MacOS|Library/(Automator|Spotlight|LoginItems))/</key>
|
||||
<dict>
|
||||
<key>nested</key>
|
||||
<true/>
|
||||
<key>weight</key>
|
||||
<real>10</real>
|
||||
</dict>
|
||||
<key>^.*</key>
|
||||
<true/>
|
||||
<key>^.*\.lproj/</key>
|
||||
<dict>
|
||||
<key>optional</key>
|
||||
<true/>
|
||||
<key>weight</key>
|
||||
<real>1000</real>
|
||||
</dict>
|
||||
<key>^.*\.lproj/locversion.plist$</key>
|
||||
<dict>
|
||||
<key>omit</key>
|
||||
<true/>
|
||||
<key>weight</key>
|
||||
<real>1100</real>
|
||||
</dict>
|
||||
<key>^Info\.plist$</key>
|
||||
<dict>
|
||||
<key>omit</key>
|
||||
<true/>
|
||||
<key>weight</key>
|
||||
<real>20</real>
|
||||
</dict>
|
||||
<key>^PkgInfo$</key>
|
||||
<dict>
|
||||
<key>omit</key>
|
||||
<true/>
|
||||
<key>weight</key>
|
||||
<real>20</real>
|
||||
</dict>
|
||||
<key>^[^/]+$</key>
|
||||
<dict>
|
||||
<key>nested</key>
|
||||
<true/>
|
||||
<key>weight</key>
|
||||
<real>10</real>
|
||||
</dict>
|
||||
<key>^embedded\.provisionprofile$</key>
|
||||
<dict>
|
||||
<key>weight</key>
|
||||
<real>20</real>
|
||||
</dict>
|
||||
<key>^version\.plist$</key>
|
||||
<dict>
|
||||
<key>weight</key>
|
||||
<real>20</real>
|
||||
</dict>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015 Lukas Kubanek
|
||||
Copyright (c) 2015-2016 Lukas Kubanek
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -8,17 +8,13 @@
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
803F9CD51B92324C002F728F /* OrderedDictionary.h in Headers */ = {isa = PBXBuildFile; fileRef = 803F9CD21B92324C002F728F /* OrderedDictionary.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
803F9CD81B9232EE002F728F /* OrderedDictionary.swift in Sources */ = {isa = PBXBuildFile; fileRef = 803F9CD71B9232EE002F728F /* OrderedDictionary.swift */; settings = {ASSET_TAGS = (); }; };
|
||||
803F9CF41B925B1C002F728F /* OrderedDictionary.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 803F9CC61B923207002F728F /* OrderedDictionary.framework */; settings = {ASSET_TAGS = (); }; };
|
||||
803F9CFD1B925B4C002F728F /* OrderedDictionaryTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 803F9CFC1B925B4C002F728F /* OrderedDictionaryTests.swift */; settings = {ASSET_TAGS = (); }; };
|
||||
803F9D001B925BBF002F728F /* Nimble.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 803F9CE91B925AE5002F728F /* Nimble.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
|
||||
803F9D011B925BE9002F728F /* Nimble.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 803F9CE91B925AE5002F728F /* Nimble.framework */; };
|
||||
803F9CD81B9232EE002F728F /* OrderedDictionary.swift in Sources */ = {isa = PBXBuildFile; fileRef = 803F9CD71B9232EE002F728F /* OrderedDictionary.swift */; };
|
||||
803F9CF41B925B1C002F728F /* OrderedDictionary.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 803F9CC61B923207002F728F /* OrderedDictionary.framework */; };
|
||||
803F9CFD1B925B4C002F728F /* OrderedDictionaryTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 803F9CFC1B925B4C002F728F /* OrderedDictionaryTests.swift */; };
|
||||
8060976B1B92F2D200DB20CF /* OrderedDictionary.swift in Sources */ = {isa = PBXBuildFile; fileRef = 803F9CD71B9232EE002F728F /* OrderedDictionary.swift */; };
|
||||
8060976C1B92F2D900DB20CF /* OrderedDictionary.h in Headers */ = {isa = PBXBuildFile; fileRef = 803F9CD21B92324C002F728F /* OrderedDictionary.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
806097761B92F44F00DB20CF /* OrderedDictionary.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 806097631B92F20400DB20CF /* OrderedDictionary.framework */; settings = {ASSET_TAGS = (); }; };
|
||||
806097761B92F44F00DB20CF /* OrderedDictionary.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 806097631B92F20400DB20CF /* OrderedDictionary.framework */; };
|
||||
8060977C1B92F4A000DB20CF /* OrderedDictionaryTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 803F9CFC1B925B4C002F728F /* OrderedDictionaryTests.swift */; };
|
||||
806097801B92F4F000DB20CF /* Nimble.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8060977F1B92F4F000DB20CF /* Nimble.framework */; settings = {ASSET_TAGS = (); }; };
|
||||
806097821B92F4FC00DB20CF /* Nimble.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 8060977F1B92F4F000DB20CF /* Nimble.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXContainerItemProxy section */
|
||||
@@ -45,7 +41,6 @@
|
||||
dstPath = "";
|
||||
dstSubfolderSpec = 10;
|
||||
files = (
|
||||
803F9D001B925BBF002F728F /* Nimble.framework in CopyFiles */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@@ -55,7 +50,6 @@
|
||||
dstPath = "";
|
||||
dstSubfolderSpec = 10;
|
||||
files = (
|
||||
806097821B92F4FC00DB20CF /* Nimble.framework in CopyFiles */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@@ -66,13 +60,11 @@
|
||||
803F9CD21B92324C002F728F /* OrderedDictionary.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OrderedDictionary.h; sourceTree = "<group>"; };
|
||||
803F9CD41B92324C002F728F /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
803F9CD71B9232EE002F728F /* OrderedDictionary.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OrderedDictionary.swift; sourceTree = "<group>"; };
|
||||
803F9CE91B925AE5002F728F /* Nimble.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Nimble.framework; path = Carthage/Build/Mac/Nimble.framework; sourceTree = "<group>"; };
|
||||
803F9CEF1B925B1C002F728F /* OrderedDictionary-OSX-Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "OrderedDictionary-OSX-Tests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
803F9CEF1B925B1C002F728F /* OrderedDictionary_Mac_Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = OrderedDictionary_Mac_Tests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
803F9CFC1B925B4C002F728F /* OrderedDictionaryTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OrderedDictionaryTests.swift; sourceTree = "<group>"; };
|
||||
803F9CFE1B925B56002F728F /* Info-Tests.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = "Info-Tests.plist"; path = "Supporting Files/Info-Tests.plist"; sourceTree = SOURCE_ROOT; };
|
||||
803F9CFE1B925B56002F728F /* Info-Tests.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Info-Tests.plist"; sourceTree = "<group>"; };
|
||||
806097631B92F20400DB20CF /* OrderedDictionary.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = OrderedDictionary.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
806097711B92F44F00DB20CF /* OrderedDictionary-iOS-Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "OrderedDictionary-iOS-Tests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
8060977F1B92F4F000DB20CF /* Nimble.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Nimble.framework; path = Carthage/Build/iOS/Nimble.framework; sourceTree = "<group>"; };
|
||||
806097711B92F44F00DB20CF /* OrderedDictionary_iOS_Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = OrderedDictionary_iOS_Tests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
80F94F181B926A60000A96E7 /* OrderedDictionary.playground */ = {isa = PBXFileReference; lastKnownFileType = file.playground; path = OrderedDictionary.playground; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
@@ -89,7 +81,6 @@
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
803F9CF41B925B1C002F728F /* OrderedDictionary.framework in Frameworks */,
|
||||
803F9D011B925BE9002F728F /* Nimble.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@@ -105,7 +96,6 @@
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
806097761B92F44F00DB20CF /* OrderedDictionary.framework in Frameworks */,
|
||||
806097801B92F4F000DB20CF /* Nimble.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@@ -119,7 +109,6 @@
|
||||
80F94F171B926A60000A96E7 /* Playgrounds */,
|
||||
803F9CFB1B925B4C002F728F /* Tests */,
|
||||
803F9CD31B92324C002F728F /* Supporting Files */,
|
||||
803F9CE81B9259F3002F728F /* Frameworks */,
|
||||
803F9CC71B923207002F728F /* Products */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
@@ -128,9 +117,9 @@
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
803F9CC61B923207002F728F /* OrderedDictionary.framework */,
|
||||
803F9CEF1B925B1C002F728F /* OrderedDictionary-OSX-Tests.xctest */,
|
||||
803F9CEF1B925B1C002F728F /* OrderedDictionary_Mac_Tests.xctest */,
|
||||
806097631B92F20400DB20CF /* OrderedDictionary.framework */,
|
||||
806097711B92F44F00DB20CF /* OrderedDictionary-iOS-Tests.xctest */,
|
||||
806097711B92F44F00DB20CF /* OrderedDictionary_iOS_Tests.xctest */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
@@ -147,21 +136,12 @@
|
||||
803F9CD31B92324C002F728F /* Supporting Files */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
803F9CD41B92324C002F728F /* Info.plist */,
|
||||
803F9CFE1B925B56002F728F /* Info-Tests.plist */,
|
||||
803F9CD41B92324C002F728F /* Info.plist */,
|
||||
);
|
||||
path = "Supporting Files";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
803F9CE81B9259F3002F728F /* Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
8060977D1B92F4D900DB20CF /* OSX */,
|
||||
8060977E1B92F4DF00DB20CF /* iOS */,
|
||||
);
|
||||
name = Frameworks;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
803F9CFB1B925B4C002F728F /* Tests */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
@@ -170,22 +150,6 @@
|
||||
path = Tests;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
8060977D1B92F4D900DB20CF /* OSX */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
803F9CE91B925AE5002F728F /* Nimble.framework */,
|
||||
);
|
||||
name = OSX;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
8060977E1B92F4DF00DB20CF /* iOS */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
8060977F1B92F4F000DB20CF /* Nimble.framework */,
|
||||
);
|
||||
name = iOS;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
80F94F171B926A60000A96E7 /* Playgrounds */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
@@ -216,9 +180,9 @@
|
||||
/* End PBXHeadersBuildPhase section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
803F9CC51B923207002F728F /* OrderedDictionary-OSX */ = {
|
||||
803F9CC51B923207002F728F /* OrderedDictionary-Mac */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 803F9CCE1B923207002F728F /* Build configuration list for PBXNativeTarget "OrderedDictionary-OSX" */;
|
||||
buildConfigurationList = 803F9CCE1B923207002F728F /* Build configuration list for PBXNativeTarget "OrderedDictionary-Mac" */;
|
||||
buildPhases = (
|
||||
803F9CC11B923207002F728F /* Sources */,
|
||||
803F9CC21B923207002F728F /* Frameworks */,
|
||||
@@ -229,14 +193,14 @@
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = "OrderedDictionary-OSX";
|
||||
name = "OrderedDictionary-Mac";
|
||||
productName = OrderedDictionary;
|
||||
productReference = 803F9CC61B923207002F728F /* OrderedDictionary.framework */;
|
||||
productType = "com.apple.product-type.framework";
|
||||
};
|
||||
803F9CEE1B925B1C002F728F /* OrderedDictionary-OSX-Tests */ = {
|
||||
803F9CEE1B925B1C002F728F /* OrderedDictionary-Mac-Tests */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 803F9CF71B925B1C002F728F /* Build configuration list for PBXNativeTarget "OrderedDictionary-OSX-Tests" */;
|
||||
buildConfigurationList = 803F9CF71B925B1C002F728F /* Build configuration list for PBXNativeTarget "OrderedDictionary-Mac-Tests" */;
|
||||
buildPhases = (
|
||||
803F9CEB1B925B1C002F728F /* Sources */,
|
||||
803F9CEC1B925B1C002F728F /* Frameworks */,
|
||||
@@ -248,9 +212,9 @@
|
||||
dependencies = (
|
||||
803F9CF61B925B1C002F728F /* PBXTargetDependency */,
|
||||
);
|
||||
name = "OrderedDictionary-OSX-Tests";
|
||||
name = "OrderedDictionary-Mac-Tests";
|
||||
productName = OrderedDictionaryTests;
|
||||
productReference = 803F9CEF1B925B1C002F728F /* OrderedDictionary-OSX-Tests.xctest */;
|
||||
productReference = 803F9CEF1B925B1C002F728F /* OrderedDictionary_Mac_Tests.xctest */;
|
||||
productType = "com.apple.product-type.bundle.unit-test";
|
||||
};
|
||||
806097621B92F20400DB20CF /* OrderedDictionary-iOS */ = {
|
||||
@@ -287,7 +251,7 @@
|
||||
);
|
||||
name = "OrderedDictionary-iOS-Tests";
|
||||
productName = "OrderedDictionary-iOS-Tests";
|
||||
productReference = 806097711B92F44F00DB20CF /* OrderedDictionary-iOS-Tests.xctest */;
|
||||
productReference = 806097711B92F44F00DB20CF /* OrderedDictionary_iOS_Tests.xctest */;
|
||||
productType = "com.apple.product-type.bundle.unit-test";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
@@ -297,20 +261,23 @@
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastSwiftUpdateCheck = 0700;
|
||||
LastUpgradeCheck = 0700;
|
||||
LastUpgradeCheck = 0800;
|
||||
ORGANIZATIONNAME = "Lukas Kubanek";
|
||||
TargetAttributes = {
|
||||
803F9CC51B923207002F728F = {
|
||||
CreatedOnToolsVersion = 7.0;
|
||||
LastSwiftMigration = 0800;
|
||||
};
|
||||
803F9CEE1B925B1C002F728F = {
|
||||
CreatedOnToolsVersion = 7.0;
|
||||
};
|
||||
806097621B92F20400DB20CF = {
|
||||
CreatedOnToolsVersion = 7.0;
|
||||
LastSwiftMigration = 0800;
|
||||
};
|
||||
806097701B92F44F00DB20CF = {
|
||||
CreatedOnToolsVersion = 7.0;
|
||||
LastSwiftMigration = 0800;
|
||||
};
|
||||
};
|
||||
};
|
||||
@@ -326,8 +293,8 @@
|
||||
projectDirPath = "";
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
803F9CC51B923207002F728F /* OrderedDictionary-OSX */,
|
||||
803F9CEE1B925B1C002F728F /* OrderedDictionary-OSX-Tests */,
|
||||
803F9CC51B923207002F728F /* OrderedDictionary-Mac */,
|
||||
803F9CEE1B925B1C002F728F /* OrderedDictionary-Mac-Tests */,
|
||||
806097621B92F20400DB20CF /* OrderedDictionary-iOS */,
|
||||
806097701B92F44F00DB20CF /* OrderedDictionary-iOS-Tests */,
|
||||
);
|
||||
@@ -403,7 +370,7 @@
|
||||
/* Begin PBXTargetDependency section */
|
||||
803F9CF61B925B1C002F728F /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
target = 803F9CC51B923207002F728F /* OrderedDictionary-OSX */;
|
||||
target = 803F9CC51B923207002F728F /* OrderedDictionary-Mac */;
|
||||
targetProxy = 803F9CF51B925B1C002F728F /* PBXContainerItemProxy */;
|
||||
};
|
||||
806097781B92F44F00DB20CF /* PBXTargetDependency */ = {
|
||||
@@ -427,8 +394,10 @@
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
@@ -450,6 +419,7 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.10;
|
||||
MTL_ENABLE_DEBUG_INFO = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
@@ -473,8 +443,10 @@
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
@@ -490,9 +462,11 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.10;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
SDKROOT = macosx;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
|
||||
VERSIONING_SYSTEM = "apple-generic";
|
||||
VERSION_INFO_PREFIX = "";
|
||||
};
|
||||
@@ -501,47 +475,47 @@
|
||||
803F9CCF1B923207002F728F /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
APPLICATION_EXTENSION_API_ONLY = YES;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
DEFINES_MODULE = YES;
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
DYLIB_CURRENT_VERSION = 1;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
FRAMEWORK_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"$(PROJECT_DIR)/Carthage/Build/Mac",
|
||||
);
|
||||
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
|
||||
FRAMEWORK_VERSION = A;
|
||||
INFOPLIST_FILE = "Supporting Files/Info.plist";
|
||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks";
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.10;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.lukaskubanek.OrderedDictionary;
|
||||
PRODUCT_NAME = OrderedDictionary;
|
||||
SKIP_INSTALL = YES;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
SWIFT_VERSION = 2.3;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
803F9CD01B923207002F728F /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
APPLICATION_EXTENSION_API_ONLY = YES;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
DEFINES_MODULE = YES;
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
DYLIB_CURRENT_VERSION = 1;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
FRAMEWORK_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"$(PROJECT_DIR)/Carthage/Build/Mac",
|
||||
);
|
||||
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
|
||||
FRAMEWORK_VERSION = A;
|
||||
INFOPLIST_FILE = "Supporting Files/Info.plist";
|
||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks";
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.10;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.lukaskubanek.OrderedDictionary;
|
||||
PRODUCT_NAME = OrderedDictionary;
|
||||
SKIP_INSTALL = YES;
|
||||
SWIFT_VERSION = 2.3;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
@@ -549,14 +523,11 @@
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
FRAMEWORK_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"$(PROJECT_DIR)/Carthage/Build/Mac",
|
||||
);
|
||||
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
|
||||
INFOPLIST_FILE = "Supporting Files/Info-Tests.plist";
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.lukaskubanek.OrderedDictionaryTests;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
@@ -564,32 +535,33 @@
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
FRAMEWORK_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"$(PROJECT_DIR)/Carthage/Build/Mac",
|
||||
);
|
||||
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
|
||||
INFOPLIST_FILE = "Supporting Files/Info-Tests.plist";
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.lukaskubanek.OrderedDictionaryTests;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
806097691B92F20400DB20CF /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
APPLICATION_EXTENSION_API_ONLY = YES;
|
||||
CODE_SIGN_IDENTITY = "iPhone Developer";
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
|
||||
DEFINES_MODULE = YES;
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
DYLIB_CURRENT_VERSION = 1;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
INFOPLIST_FILE = "Supporting Files/Info.plist";
|
||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.lukaskubanek.OrderedDictionary;
|
||||
PRODUCT_NAME = OrderedDictionary;
|
||||
SDKROOT = iphoneos;
|
||||
SKIP_INSTALL = YES;
|
||||
SWIFT_VERSION = 2.3;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
};
|
||||
name = Debug;
|
||||
@@ -597,18 +569,22 @@
|
||||
8060976A1B92F20400DB20CF /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
APPLICATION_EXTENSION_API_ONLY = YES;
|
||||
CODE_SIGN_IDENTITY = "iPhone Developer";
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
|
||||
DEFINES_MODULE = YES;
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
DYLIB_CURRENT_VERSION = 1;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
INFOPLIST_FILE = "Supporting Files/Info.plist";
|
||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.lukaskubanek.OrderedDictionary;
|
||||
PRODUCT_NAME = OrderedDictionary;
|
||||
SDKROOT = iphoneos;
|
||||
SKIP_INSTALL = YES;
|
||||
SWIFT_VERSION = 2.3;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
VALIDATE_PRODUCT = YES;
|
||||
};
|
||||
@@ -617,32 +593,28 @@
|
||||
8060977A1B92F44F00DB20CF /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
FRAMEWORK_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"$(PROJECT_DIR)/Carthage/Build/iOS",
|
||||
);
|
||||
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
|
||||
INFOPLIST_FILE = "Supporting Files/Info-Tests.plist";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "com.lukaskubanek.OrderedDictionary-iOS-Tests";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
|
||||
SDKROOT = iphoneos;
|
||||
SWIFT_VERSION = 2.3;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
8060977B1B92F44F00DB20CF /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
FRAMEWORK_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"$(PROJECT_DIR)/Carthage/Build/iOS",
|
||||
);
|
||||
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
|
||||
INFOPLIST_FILE = "Supporting Files/Info-Tests.plist";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "com.lukaskubanek.OrderedDictionary-iOS-Tests";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
|
||||
SDKROOT = iphoneos;
|
||||
SWIFT_VERSION = 2.3;
|
||||
VALIDATE_PRODUCT = YES;
|
||||
};
|
||||
name = Release;
|
||||
@@ -659,7 +631,7 @@
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
803F9CCE1B923207002F728F /* Build configuration list for PBXNativeTarget "OrderedDictionary-OSX" */ = {
|
||||
803F9CCE1B923207002F728F /* Build configuration list for PBXNativeTarget "OrderedDictionary-Mac" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
803F9CCF1B923207002F728F /* Debug */,
|
||||
@@ -668,7 +640,7 @@
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
803F9CF71B925B1C002F728F /* Build configuration list for PBXNativeTarget "OrderedDictionary-OSX-Tests" */ = {
|
||||
803F9CF71B925B1C002F728F /* Build configuration list for PBXNativeTarget "OrderedDictionary-Mac-Tests" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
803F9CF81B925B1C002F728F /* Debug */,
|
||||
@@ -684,6 +656,7 @@
|
||||
8060976A1B92F20400DB20CF /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
806097791B92F44F00DB20CF /* Build configuration list for PBXNativeTarget "OrderedDictionary-iOS-Tests" */ = {
|
||||
isa = XCConfigurationList;
|
||||
@@ -692,6 +665,7 @@
|
||||
8060977B1B92F44F00DB20CF /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
|
||||
+7
-7
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0700"
|
||||
LastUpgradeVersion = "0800"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
@@ -16,7 +16,7 @@
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "803F9CC51B923207002F728F"
|
||||
BuildableName = "OrderedDictionary.framework"
|
||||
BlueprintName = "OrderedDictionary-OSX"
|
||||
BlueprintName = "OrderedDictionary-Mac"
|
||||
ReferencedContainer = "container:OrderedDictionary.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
@@ -34,8 +34,8 @@
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "803F9CEE1B925B1C002F728F"
|
||||
BuildableName = "OrderedDictionary-OSX-Tests.xctest"
|
||||
BlueprintName = "OrderedDictionary-OSX-Tests"
|
||||
BuildableName = "OrderedDictionary_Mac_Tests.xctest"
|
||||
BlueprintName = "OrderedDictionary-Mac-Tests"
|
||||
ReferencedContainer = "container:OrderedDictionary.xcodeproj">
|
||||
</BuildableReference>
|
||||
</TestableReference>
|
||||
@@ -45,7 +45,7 @@
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "803F9CC51B923207002F728F"
|
||||
BuildableName = "OrderedDictionary.framework"
|
||||
BlueprintName = "OrderedDictionary-OSX"
|
||||
BlueprintName = "OrderedDictionary-Mac"
|
||||
ReferencedContainer = "container:OrderedDictionary.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
@@ -67,7 +67,7 @@
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "803F9CC51B923207002F728F"
|
||||
BuildableName = "OrderedDictionary.framework"
|
||||
BlueprintName = "OrderedDictionary-OSX"
|
||||
BlueprintName = "OrderedDictionary-Mac"
|
||||
ReferencedContainer = "container:OrderedDictionary.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
@@ -85,7 +85,7 @@
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "803F9CC51B923207002F728F"
|
||||
BuildableName = "OrderedDictionary.framework"
|
||||
BlueprintName = "OrderedDictionary-OSX"
|
||||
BlueprintName = "OrderedDictionary-Mac"
|
||||
ReferencedContainer = "container:OrderedDictionary.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0700"
|
||||
LastUpgradeVersion = "0800"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
@@ -34,7 +34,7 @@
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "806097701B92F44F00DB20CF"
|
||||
BuildableName = "OrderedDictionary-iOS-Tests.xctest"
|
||||
BuildableName = "OrderedDictionary_iOS_Tests.xctest"
|
||||
BlueprintName = "OrderedDictionary-iOS-Tests"
|
||||
ReferencedContainer = "container:OrderedDictionary.xcodeproj">
|
||||
</BuildableReference>
|
||||
|
||||
@@ -1,65 +1,129 @@
|
||||
// Import the framework
|
||||
import OrderedDictionary
|
||||
|
||||
////
|
||||
// Initialize an ordered dictionary using an array of key-value pairs
|
||||
////
|
||||
|
||||
var orderedDictionary: OrderedDictionary<String, Int> = [
|
||||
("A", 1),
|
||||
("B", 2),
|
||||
("C", 3),
|
||||
("D", 4)
|
||||
]
|
||||
// ======================================================= //
|
||||
// CONSTRUCTION
|
||||
// ======================================================= //
|
||||
|
||||
// Construct an ordered dictionary using a dictionary literal
|
||||
var orderedDictionary: OrderedDictionary<String, Int> = ["A": 1, "B": 2, "C": 3, "D": 4]
|
||||
print(orderedDictionary) // => [A: 1, B: 2, C: 3, D: 4]
|
||||
|
||||
////
|
||||
// Loop through the contents
|
||||
////
|
||||
// ======================================================= //
|
||||
// LOOPING
|
||||
// ======================================================= //
|
||||
|
||||
for (index, (key, value)) in orderedDictionary.enumerate() {
|
||||
print("\(index): (\(key): \(value))")
|
||||
// Loop through the ordered dictionary
|
||||
for (key, value) in orderedDictionary {
|
||||
print("[\(key): \(value)]") // => [A: 1], => [B: 2], => [C: 3], => [D: 4]
|
||||
}
|
||||
|
||||
// => 0: (A: 1)
|
||||
// => 1: (B: 2)
|
||||
// => 2: (C: 3)
|
||||
// => 3: (D: 4)
|
||||
// Loop through the ordered dictionary with an additional index
|
||||
for (index, (key, value)) in orderedDictionary.enumerate() {
|
||||
print("(\(index): [\(key): \(value)])") // => (0: [A: 1]), => (1: [B: 2]), => (2: [C: 3]), => (3: [D: 4])
|
||||
}
|
||||
|
||||
////
|
||||
// Modify the values by setting the value for key
|
||||
////
|
||||
// ======================================================= //
|
||||
// ACCESSING CONTENT
|
||||
// ======================================================= //
|
||||
|
||||
// Access the value for an existing key using subscript
|
||||
print(orderedDictionary["A"]) // => Optional(1)
|
||||
|
||||
// Access the value for a non-existent key
|
||||
print(orderedDictionary["X"]) // => nil
|
||||
|
||||
// Access the value for a key using method
|
||||
print(orderedDictionary.valueForKey("A")) // => Optional(1)
|
||||
|
||||
// Access the value for a non-existent key
|
||||
print(orderedDictionary.valueForKey("X")) // => nil
|
||||
|
||||
// Access the key-value pair (element) at an existing index
|
||||
print(orderedDictionary[2]) // => ("C", 3)
|
||||
|
||||
// Access the key-value pair (element) at a non-existent index
|
||||
//print(orderedDictionary[10]) // => fatal error
|
||||
|
||||
// Get the index for an existing key
|
||||
print(orderedDictionary.indexForKey("D")) // => Optional(3)
|
||||
|
||||
// ======================================================= //
|
||||
// MODIFYING CONTENT USING KEYS
|
||||
// ======================================================= //
|
||||
|
||||
// Modify the value for an existing key using subscript
|
||||
orderedDictionary["A"] = 100
|
||||
orderedDictionary["E"] = 5
|
||||
orderedDictionary["B"] = nil
|
||||
orderedDictionary.updateValue(42, forKey: "D")
|
||||
print(orderedDictionary["A"]) // => Optional(100)
|
||||
|
||||
// Modify the value for an existing key using method
|
||||
orderedDictionary.updateValue(42, forKey: "D")
|
||||
print(orderedDictionary["D"]) // => Optional(42)
|
||||
|
||||
// Set a value for an non-existent key
|
||||
orderedDictionary["E"] = 5
|
||||
print(orderedDictionary) // => [A: 100, B: 2, C: 3, D: 42, E: 5]
|
||||
|
||||
// Set nil value for an existing key
|
||||
orderedDictionary["B"] = nil
|
||||
print(orderedDictionary["B"]) // => nil
|
||||
print(orderedDictionary) // => [A: 100, C: 3, D: 42, E: 5]
|
||||
|
||||
print(orderedDictionary["A"]) // => Optional(100)
|
||||
print(orderedDictionary["B"]) // => nil
|
||||
print(orderedDictionary["C"]) // => Optional(3)
|
||||
print(orderedDictionary["D"]) // => Optional(42)
|
||||
print(orderedDictionary["E"]) // => Optional(5)
|
||||
|
||||
////
|
||||
// Modify the values by setting the element for index
|
||||
////
|
||||
// ======================================================= //
|
||||
// MODIFYING CONTENT USING INDEXES
|
||||
// ======================================================= //
|
||||
|
||||
// Modify the existing element at index using subscript
|
||||
orderedDictionary[2] = ("F", 235)
|
||||
orderedDictionary.updateElement(("K", 12), atIndex: 1)
|
||||
orderedDictionary.removeAtIndex(0)
|
||||
print(orderedDictionary[2]) // => ("F", 235)
|
||||
print(orderedDictionary) // => [A: 100, C: 3, F: 235, E: 5]
|
||||
|
||||
print(orderedDictionary) // => [K: 12, F: 235, E: 5]
|
||||
// Modify the existing element at index using method
|
||||
let previousElement = orderedDictionary.updateElement(("K", 12), atIndex: 1)
|
||||
print(orderedDictionary[1]) // => ("K", 12)
|
||||
print(previousElement) // => Optional("C", 3)
|
||||
print(orderedDictionary) // => [A: 100, K: 12, F: 235, E: 5]
|
||||
|
||||
print(orderedDictionary[0]) // => ("K", 12)
|
||||
print(orderedDictionary[1]) // => ("F", 235)
|
||||
print(orderedDictionary[2]) // => ("E", 5)
|
||||
// print(orderedDictionary[3]) // => fatal error
|
||||
// Set an element to a non-existent index
|
||||
//orderedDictionary[100] = ("L", 0) // => fatal error
|
||||
|
||||
print(orderedDictionary.indexForKey("K")) // => Optional(0)
|
||||
print(orderedDictionary.indexForKey("F")) // => Optional(1)
|
||||
print(orderedDictionary.indexForKey("E")) // => Optional(2)
|
||||
print(orderedDictionary.indexForKey("A")) // => nil
|
||||
print(orderedDictionary.indexForKey("C")) // => nil
|
||||
// ======================================================= //
|
||||
// SORTING
|
||||
// ======================================================= //
|
||||
|
||||
// Sort the ordered dictionary using a closure
|
||||
orderedDictionary.sortInPlace { (element1: (key: String, value: Int), element2: (key: String, value: Int)) -> Bool in
|
||||
if element1.value == element2.value {
|
||||
return element1.key < element2.key
|
||||
} else {
|
||||
return element1.value < element2.value
|
||||
}
|
||||
}
|
||||
print(orderedDictionary) // => [E: 5, K: 12, A: 100, F: 235]
|
||||
|
||||
// ======================================================= //
|
||||
// REMOVING CONTENT
|
||||
// ======================================================= //
|
||||
|
||||
// Remove value for an existing key
|
||||
let removedValue = orderedDictionary.removeValueForKey("F")
|
||||
print(removedValue) // => Optional(235)
|
||||
print(orderedDictionary["F"]) // => nil
|
||||
print(orderedDictionary) // => [E: 5, K: 12, A: 100]
|
||||
|
||||
// Remove value for a non-existent key
|
||||
orderedDictionary.removeValueForKey("X")
|
||||
print(orderedDictionary) // => [E: 5, K: 12, A: 100]
|
||||
|
||||
// Remove element at an existing index
|
||||
let removedElement = orderedDictionary.removeAtIndex(1)
|
||||
print(removedElement) // => Optional((K, 12))
|
||||
print(orderedDictionary) // => [E: 5, A: 100]
|
||||
|
||||
// Remove element at a non-existent index
|
||||
orderedDictionary.removeAtIndex(42)
|
||||
print(orderedDictionary) // => [E: 5, A: 100]
|
||||
|
||||
// Remove all elements
|
||||
orderedDictionary.removeAll()
|
||||
print(orderedDictionary) // => [:]
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<playground version='5.0' target-platform='osx' requires-full-environment='true'>
|
||||
<playground version='5.0' target-platform='osx'>
|
||||
<timeline fileName='timeline.xctimeline'/>
|
||||
</playground>
|
||||
@@ -2,99 +2,45 @@
|
||||
|
||||
[![][image-1]][1] [![][image-2]][2] [![][image-3]][3] ![][image-4] [![][image-5]][4] [![][image-6]][5]
|
||||
|
||||
This is a lightweight implementation of an ordered dictionary data structure in Swift packed into a µframework.
|
||||
**OrderedDictionary** is a lightweight implementation of an ordered dictionary data structure in Swift.
|
||||
|
||||
`OrderedDictionary` is an immutable generic collection which combines the features of `Dictionary` and `Array`. Like `Dictionary` it stores key-value pairs and maps the keys to values. Additionally these pairs are sorted by zero-based integer index like in `Array`. The `OrderedDictionary` provides similar APIs to the collections from the Swift standard library and allows accessing the content by keys or indexes.
|
||||
The `OrderedDictionary` structure is an immutable generic collection which combines the features of `Dictionary` and `Array` from the Swift standard library. Like `Dictionary` it stores key-value pairs and maps each key to a value. Like `Array` it stores those pairs sorted and accessible by a zero-based integer index.
|
||||
|
||||
Internally `OrderedDictionary` uses a backing store composed of an instance of `Dictionary` for storing the key-value pairs and an instance of `Array` for managing the ordered keys.
|
||||
`OrderedDictionary` provides similar APIs like collections in the Swift standard library. This includes accessing contents by keys or indexes, inserting and removing elements, iterating, sorting etc.
|
||||
|
||||
Internally `OrderedDictionary` uses a backing store composed of an instance of `Dictionary` for storing the key-value pairs and an instance of `Array` for managing the ordered keys. This means it is not the most performant implementation possible, but it gets its job done by reusing most functionality from the Swift standard library.
|
||||
|
||||
## Requirements
|
||||
|
||||
- Swift 2.0
|
||||
- Xcode 7.0 beta 6+
|
||||
- Swift 2.3
|
||||
- Xcode 8
|
||||
- iOS 8.0+ / OS X 10.10+
|
||||
|
||||
## Installation
|
||||
|
||||
The easiest way to integrate `OrderedDictionary` to your project is to use [Carthage][6]. Add following line to your `Cartfile`:
|
||||
This library is distributed as a Swift framework and can be integrated into your project in following ways:
|
||||
|
||||
```
|
||||
github "lukaskubanek/OrderedDictionary" ~> 0.1
|
||||
```
|
||||
### Carthage
|
||||
|
||||
Then drag the `OrderedDictionary.xcodeproj` or the `OrderedDictionary.framework` into your project/workspace and link against the `OrderedDictionary.framework`.
|
||||
The easiest way is to use the package manager [Carthage][6].
|
||||
|
||||
Finally make sure the framework gets copied into your application bundle.
|
||||
1. Add `github "lukaskubanek/OrderedDictionary"` to your `Cartfile`.
|
||||
2. Run `carthage bootstrap`.
|
||||
3. Drag either the `OrderedDictionary.xcodeproj` or the `OrderedDictionary.framework` into your project/workspace and link your target against the `OrderedDictionary.framework`.
|
||||
4. Make sure the framework [gets copied][7] to your application bundle.
|
||||
5. Import the framework using `import OrderedDictionary`.
|
||||
|
||||
## Example Usage
|
||||
### Submodule & Xcode Project
|
||||
|
||||
```swift
|
||||
import OrderedDictionary
|
||||
Another option is to use [Git submodules][8] and integrating the Xcode project `OrderedDictionary.xcodeproj` directly to your Xcode workspace.
|
||||
|
||||
////
|
||||
// Initialize an ordered dictionary using an array of key-value pairs
|
||||
////
|
||||
## Usage
|
||||
|
||||
var orderedDictionary: OrderedDictionary<String, Int> = [
|
||||
("A", 1),
|
||||
("B", 2),
|
||||
("C", 3),
|
||||
("D", 4)
|
||||
]
|
||||
For the usage of this library please refer to the [example playground][9].
|
||||
|
||||
print(orderedDictionary) // => [A: 1, B: 2, C: 3, D: 4]
|
||||
## Changelog
|
||||
|
||||
////
|
||||
// Loop through the contents
|
||||
////
|
||||
|
||||
for (index, (key, value)) in orderedDictionary.enumerate() {
|
||||
print("\(index): (\(key): \(value))")
|
||||
}
|
||||
|
||||
// => 0: (A: 1)
|
||||
// => 1: (B: 2)
|
||||
// => 2: (C: 3)
|
||||
// => 3: (D: 4)
|
||||
|
||||
////
|
||||
// Modify the values by setting the value for key
|
||||
////
|
||||
|
||||
orderedDictionary["A"] = 100
|
||||
orderedDictionary["E"] = 5
|
||||
orderedDictionary["B"] = nil
|
||||
orderedDictionary.updateValue(42, forKey: "D")
|
||||
|
||||
print(orderedDictionary) // => [A: 100, C: 3, D: 42, E: 5]
|
||||
|
||||
print(orderedDictionary["A"]) // => Optional(100)
|
||||
print(orderedDictionary["B"]) // => nil
|
||||
print(orderedDictionary["C"]) // => Optional(3)
|
||||
print(orderedDictionary["D"]) // => Optional(42)
|
||||
print(orderedDictionary["E"]) // => Optional(5)
|
||||
|
||||
////
|
||||
// Modify the values by setting the element for index
|
||||
////
|
||||
|
||||
orderedDictionary[2] = ("F", 235)
|
||||
orderedDictionary.updateElement(("K", 12), atIndex: 1)
|
||||
orderedDictionary.removeAtIndex(0)
|
||||
|
||||
print(orderedDictionary) // => [K: 12, F: 235, E: 5]
|
||||
|
||||
print(orderedDictionary[0]) // => ("K", 12)
|
||||
print(orderedDictionary[1]) // => ("F", 235)
|
||||
print(orderedDictionary[2]) // => ("E", 5)
|
||||
// print(orderedDictionary[3]) // => fatal error
|
||||
|
||||
print(orderedDictionary.indexForKey("K")) // => Optional(0)
|
||||
print(orderedDictionary.indexForKey("F")) // => Optional(1)
|
||||
print(orderedDictionary.indexForKey("E")) // => Optional(2)
|
||||
print(orderedDictionary.indexForKey("A")) // => nil
|
||||
print(orderedDictionary.indexForKey("C")) // => nil
|
||||
```
|
||||
The changelog is managed on the [GitHub releases page][10].
|
||||
|
||||
## Author
|
||||
|
||||
@@ -102,25 +48,25 @@ Lukas Kubanek // [lukaskubanek.com][11] // [@kubanekl][12]
|
||||
|
||||
## License
|
||||
|
||||
`OrderedDictionary` is released under the [MIT License][13].
|
||||
**OrderedDictionary** is provided under the [MIT License][13].
|
||||
|
||||
[1]: https://travis-ci.org/lukaskubanek/OrderedDictionary
|
||||
[2]: https://github.com/lukaskubanek/OrderedDictionary/releases
|
||||
[3]: https://developer.apple.com/swift/
|
||||
[4]: https://github.com/Carthage/Carthage
|
||||
[5]: LICENSE.md
|
||||
[6]: https://github.com/Carthage/Carthage/
|
||||
[7]: https://developer.apple.com/swift/
|
||||
[8]: https://github.com/lukaskubanek/OrderedDictionary/releases
|
||||
[9]: https://developer.apple.com/swift/
|
||||
[10]: https://github.com/Carthage/Carthage
|
||||
[6]: https://github.com/Carthage/Carthage
|
||||
[7]: https://github.com/Carthage/Carthage#adding-frameworks-to-an-application
|
||||
[8]: http://git-scm.com/book/en/v2/Git-Tools-Submodules
|
||||
[9]: Playgrounds/OrderedDictionary.playground/Contents.swift
|
||||
[10]: https://github.com/lukaskubanek/OrderedDictionary/releases
|
||||
[11]: http://lukaskubanek.com
|
||||
[12]: https://twitter.com/kubanekl
|
||||
[13]: LICENSE.md
|
||||
|
||||
[image-1]: https://img.shields.io/travis/lukaskubanek/OrderedDictionary.svg?style=flat-square
|
||||
[image-1]: https://img.shields.io/travis/lukaskubanek/OrderedDictionary.svg?style=flat-square "Build"
|
||||
[image-2]: https://img.shields.io/github/release/lukaskubanek/OrderedDictionary.svg?style=flat-square
|
||||
[image-3]: https://img.shields.io/badge/Swift-2.0_(7b6)-orange.svg?style=flat-square
|
||||
[image-4]: https://img.shields.io/badge/platform-OS_X%20&_iOS-yellowgreen.svg?style=flat-square
|
||||
[image-3]: https://img.shields.io/badge/Swift-2.3-orange.svg?style=flat-square "Swift 2.2"
|
||||
[image-4]: https://img.shields.io/badge/platform-macOS/iOS-yellowgreen.svg?style=flat-square "Platform: OS X, iOS"
|
||||
[image-5]: https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat-square "Carthage compatible"
|
||||
[image-6]: https://img.shields.io/badge/license-MIT-lightgrey.svg?style=flat-square "License"
|
||||
[image-6]: https://img.shields.io/badge/license-MIT-lightgrey.svg?style=flat-square "License: MIT"
|
||||
@@ -5,6 +5,3 @@
|
||||
// Created by Lukas Kubanek on 29/08/15.
|
||||
// Copyright © 2015 Lukas Kubanek. All rights reserved.
|
||||
//
|
||||
|
||||
extern double OrderedDictionaryVersionNumber;
|
||||
extern const unsigned char OrderedDictionaryVersionString[];
|
||||
|
||||
+183
-75
@@ -6,39 +6,47 @@
|
||||
// Copyright © 2015 Lukas Kubanek. All rights reserved.
|
||||
//
|
||||
|
||||
/// The `OrderedDictionary` is a collection which combines the features of `Dictionary` and `Array`.
|
||||
/// It maps keys to values and additionally sorts the key-value pairs by zero-based integer index.
|
||||
public struct OrderedDictionary<Key: Hashable, Value>: CollectionType, ArrayLiteralConvertible, CustomStringConvertible {
|
||||
public struct OrderedDictionary<Key: Hashable, Value>: MutableCollectionType {
|
||||
|
||||
// ======================================================= //
|
||||
// MARK: - Type Aliases
|
||||
// ======================================================= //
|
||||
|
||||
public typealias Element = (Key, Value)
|
||||
|
||||
public typealias Index = Int
|
||||
|
||||
// ======================================================= //
|
||||
// MARK: - Initialization
|
||||
// ======================================================= //
|
||||
|
||||
public init() {
|
||||
self.orderedKeys = []
|
||||
self.keysToValues = [:]
|
||||
}
|
||||
public init() {}
|
||||
|
||||
public init(elements: [Element]) {
|
||||
self.init()
|
||||
|
||||
for element in elements {
|
||||
self[element.0] = element.1
|
||||
for (key, value) in elements {
|
||||
self[key] = value
|
||||
}
|
||||
}
|
||||
|
||||
public init(arrayLiteral elements: Element...) {
|
||||
self.init(elements: elements)
|
||||
// ======================================================= //
|
||||
// MARK: - Accessing Keys & Values
|
||||
// ======================================================= //
|
||||
|
||||
public var orderedKeys: [Key] {
|
||||
return _orderedKeys
|
||||
}
|
||||
|
||||
// MARK: - Type Aliases
|
||||
|
||||
public typealias Element = (Key, Value)
|
||||
public typealias Index = Int
|
||||
public var orderedValues: [Value] {
|
||||
return _orderedKeys.flatMap { _keysToValues[$0] }
|
||||
}
|
||||
|
||||
// ======================================================= //
|
||||
// MARK: - Managing Content Using Keys
|
||||
// ======================================================= //
|
||||
|
||||
public subscript(key: Key) -> Value? {
|
||||
get {
|
||||
return keysToValues[key]
|
||||
return valueForKey(key)
|
||||
}
|
||||
set(newValue) {
|
||||
if let newValue = newValue {
|
||||
@@ -50,26 +58,39 @@ public struct OrderedDictionary<Key: Hashable, Value>: CollectionType, ArrayLite
|
||||
}
|
||||
|
||||
public func containsKey(key: Key) -> Bool {
|
||||
return orderedKeys.contains(key)
|
||||
return _orderedKeys.contains(key)
|
||||
}
|
||||
|
||||
public func valueForKey(key: Key) -> Value? {
|
||||
return _keysToValues[key]
|
||||
}
|
||||
|
||||
public mutating func updateValue(value: Value, forKey key: Key) -> Value? {
|
||||
if orderedKeys.contains(key) {
|
||||
guard let currentValue = keysToValues[key] else { fatalError("Inconsistency error occured in OrderedDictionary.") }
|
||||
keysToValues[key] = value
|
||||
if _orderedKeys.contains(key) {
|
||||
guard let currentValue = _keysToValues[key] else {
|
||||
fatalError("Inconsistency error occured in OrderedDictionary")
|
||||
}
|
||||
|
||||
_keysToValues[key] = value
|
||||
|
||||
return currentValue
|
||||
} else {
|
||||
orderedKeys.append(key)
|
||||
keysToValues[key] = value
|
||||
_orderedKeys.append(key)
|
||||
_keysToValues[key] = value
|
||||
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
public mutating func removeValueForKey(key: Key) -> Value? {
|
||||
if let index = orderedKeys.indexOf(key) {
|
||||
orderedKeys.removeAtIndex(index)
|
||||
guard let currentValue = keysToValues[key] else { fatalError("Inconsistency error occured in OrderedDictionary.") }
|
||||
keysToValues[key] = nil
|
||||
if let index = _orderedKeys.indexOf(key) {
|
||||
guard let currentValue = _keysToValues[key] else {
|
||||
fatalError("Inconsistency error occured in OrderedDictionary")
|
||||
}
|
||||
|
||||
_orderedKeys.removeAtIndex(index)
|
||||
_keysToValues[key] = nil
|
||||
|
||||
return currentValue
|
||||
} else {
|
||||
return nil
|
||||
@@ -77,19 +98,21 @@ public struct OrderedDictionary<Key: Hashable, Value>: CollectionType, ArrayLite
|
||||
}
|
||||
|
||||
public mutating func removeAll(keepCapacity keepCapacity: Bool = true) {
|
||||
orderedKeys.removeAll(keepCapacity: keepCapacity)
|
||||
keysToValues.removeAll(keepCapacity: keepCapacity)
|
||||
_orderedKeys.removeAll(keepCapacity: keepCapacity)
|
||||
_keysToValues.removeAll(keepCapacity: keepCapacity)
|
||||
}
|
||||
|
||||
// ======================================================= //
|
||||
// MARK: - Managing Content Using Indexes
|
||||
// ======================================================= //
|
||||
|
||||
public subscript(index: Index) -> Element {
|
||||
get {
|
||||
if let element = elementAtIndex(index) {
|
||||
return element
|
||||
} else {
|
||||
fatalError("Index out of bounds in OrderedDictionary.")
|
||||
guard let element = elementAtIndex(index) else {
|
||||
fatalError("OrderedDictionary index out of range")
|
||||
}
|
||||
|
||||
return element
|
||||
}
|
||||
set(newValue) {
|
||||
updateElement(newValue, atIndex: index)
|
||||
@@ -97,38 +120,73 @@ public struct OrderedDictionary<Key: Hashable, Value>: CollectionType, ArrayLite
|
||||
}
|
||||
|
||||
public func indexForKey(key: Key) -> Index? {
|
||||
return orderedKeys.indexOf(key)
|
||||
return _orderedKeys.indexOf(key)
|
||||
}
|
||||
|
||||
public func elementAtIndex(index: Index) -> Element? {
|
||||
guard orderedKeys.indices.contains(index) else { return nil }
|
||||
guard _orderedKeys.indices.contains(index) else { return nil }
|
||||
|
||||
let key = orderedKeys[index]
|
||||
guard let value = self.keysToValues[key] else { fatalError("Inconsistency error occured in OrderedDictionary.") }
|
||||
let key = _orderedKeys[index]
|
||||
|
||||
guard let value = self._keysToValues[key] else {
|
||||
fatalError("Inconsistency error occured in OrderedDictionary")
|
||||
}
|
||||
|
||||
return (key, value)
|
||||
}
|
||||
|
||||
public mutating func updateElement(element: Element, atIndex index: Index) -> Element? {
|
||||
// TODO: Handle index out of range
|
||||
|
||||
let currentElement = elementAtIndex(index)
|
||||
|
||||
if currentElement != nil {
|
||||
keysToValues.removeValueForKey(element.0)
|
||||
public mutating func insertElementWithKey(key: Key, value: Value, atIndex index: Index) -> Value? {
|
||||
return insertElement((key, value), atIndex: index)
|
||||
}
|
||||
|
||||
public mutating func insertElement(newElement: Element, atIndex index: Index) -> Value? {
|
||||
guard index >= 0 else {
|
||||
fatalError("Negative OrderedDictionary index is out of range")
|
||||
}
|
||||
|
||||
let (newKey, newValue) = (element.0, element.1)
|
||||
orderedKeys[index] = newKey
|
||||
keysToValues[newKey] = newValue
|
||||
guard index <= count else {
|
||||
fatalError("OrderedDictionary index out of range")
|
||||
}
|
||||
|
||||
let (key, value) = newElement
|
||||
|
||||
let adjustedIndex: Int
|
||||
let currentValue: Value?
|
||||
|
||||
if let currentIndex = _orderedKeys.indexOf(key) {
|
||||
currentValue = _keysToValues[key]
|
||||
adjustedIndex = (currentIndex < index - 1) ? index - 1 : index
|
||||
|
||||
_orderedKeys.removeAtIndex(currentIndex)
|
||||
_keysToValues[key] = nil
|
||||
} else {
|
||||
currentValue = nil
|
||||
adjustedIndex = index
|
||||
}
|
||||
|
||||
_orderedKeys.insert(key, atIndex: adjustedIndex)
|
||||
_keysToValues[key] = value
|
||||
|
||||
return currentValue
|
||||
}
|
||||
|
||||
public mutating func updateElement(element: Element, atIndex index: Index) -> Element? {
|
||||
guard let currentElement = elementAtIndex(index) else {
|
||||
fatalError("OrderedDictionary index out of range")
|
||||
}
|
||||
|
||||
let (newKey, newValue) = element
|
||||
|
||||
_orderedKeys[index] = newKey
|
||||
_keysToValues[newKey] = newValue
|
||||
|
||||
return currentElement
|
||||
}
|
||||
|
||||
public mutating func removeAtIndex(index: Index) -> Element? {
|
||||
if let element = elementAtIndex(index) {
|
||||
orderedKeys.removeAtIndex(index)
|
||||
keysToValues.removeValueForKey(element.0)
|
||||
_orderedKeys.removeAtIndex(index)
|
||||
_keysToValues.removeValueForKey(element.0)
|
||||
|
||||
return element
|
||||
} else {
|
||||
@@ -136,43 +194,93 @@ public struct OrderedDictionary<Key: Hashable, Value>: CollectionType, ArrayLite
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Description
|
||||
// ======================================================= //
|
||||
// MARK: - CollectionType Conformance
|
||||
// ======================================================= //
|
||||
|
||||
public var startIndex: Index {
|
||||
return _orderedKeys.startIndex
|
||||
}
|
||||
|
||||
public var endIndex: Index {
|
||||
return _orderedKeys.endIndex
|
||||
}
|
||||
|
||||
// ======================================================= //
|
||||
// MARK: - Internal Backing Store
|
||||
// ======================================================= //
|
||||
|
||||
/// The backing store for the ordered keys.
|
||||
private var _orderedKeys = [Key]()
|
||||
|
||||
/// The backing store for the mapping of keys to values.
|
||||
private var _keysToValues = [Key: Value]()
|
||||
|
||||
}
|
||||
|
||||
// ======================================================= //
|
||||
// MARK: - Initializations from Literals
|
||||
// ======================================================= //
|
||||
|
||||
extension OrderedDictionary: ArrayLiteralConvertible {
|
||||
|
||||
public init(arrayLiteral elements: Element...) {
|
||||
self.init(elements: elements)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
extension OrderedDictionary: DictionaryLiteralConvertible {
|
||||
|
||||
public init(dictionaryLiteral elements: Element...) {
|
||||
self.init(elements: elements)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// ======================================================= //
|
||||
// MARK: - Description
|
||||
// ======================================================= //
|
||||
|
||||
extension OrderedDictionary: CustomStringConvertible, CustomDebugStringConvertible {
|
||||
|
||||
public var description: String {
|
||||
let content = map({ "\($0.0): \($0.1)" }).joinWithSeparator(", ")
|
||||
return "[\(content)]"
|
||||
return constructDescription(debug: false)
|
||||
}
|
||||
|
||||
// MARK: - Backing Store
|
||||
public var debugDescription: String {
|
||||
return constructDescription(debug: true)
|
||||
}
|
||||
|
||||
private var orderedKeys: [Key]
|
||||
private var keysToValues: [Key: Value]
|
||||
|
||||
// MARK: - SequenceType & Indexable Conformance
|
||||
|
||||
public func generate() -> AnyGenerator<Element> {
|
||||
var nextIndex = 0
|
||||
let lastIndex = self.count
|
||||
private func constructDescription(debug debug: Bool) -> String {
|
||||
// The implementation of the description is inspired by zwaldowski's implementation of the ordered dictionary.
|
||||
// See http://bit.ly/1VL4JUR
|
||||
|
||||
return anyGenerator {
|
||||
guard nextIndex < lastIndex else { return nil }
|
||||
if isEmpty { return "[:]" }
|
||||
|
||||
func descriptionForItem(item: Any) -> String {
|
||||
var description = ""
|
||||
|
||||
let nextKey = self.orderedKeys[nextIndex]
|
||||
guard let nextValue = self.keysToValues[nextKey] else { fatalError("Inconsistency error occured in OrderedDictionary.") }
|
||||
let element = (nextKey, nextValue)
|
||||
if debug {
|
||||
debugPrint(item, separator: "", terminator: "", toStream: &description)
|
||||
} else {
|
||||
print(item, separator: "", terminator: "", toStream: &description)
|
||||
}
|
||||
|
||||
nextIndex++
|
||||
|
||||
return element
|
||||
return description
|
||||
}
|
||||
|
||||
let bodyComponents = map({ (key: Key, value: Value) -> String in
|
||||
return descriptionForItem(key) + ": " + descriptionForItem(value)
|
||||
})
|
||||
|
||||
let body = bodyComponents.joinWithSeparator(", ")
|
||||
|
||||
return "[\(body)]"
|
||||
}
|
||||
|
||||
public var startIndex: Index { return orderedKeys.startIndex }
|
||||
|
||||
public var endIndex: Index { return orderedKeys.endIndex }
|
||||
|
||||
}
|
||||
|
||||
public func == <Key: Equatable, Value: Equatable>(lhs: OrderedDictionary<Key, Value>, rhs: OrderedDictionary<Key, Value>) -> Bool {
|
||||
return lhs.orderedKeys == rhs.orderedKeys && lhs.keysToValues == rhs.keysToValues
|
||||
return lhs._orderedKeys == rhs._orderedKeys && lhs._keysToValues == rhs._keysToValues
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>0.1</string>
|
||||
<string>0.5</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
|
||||
+255
-125
@@ -7,171 +7,301 @@
|
||||
//
|
||||
|
||||
import XCTest
|
||||
import Nimble
|
||||
import OrderedDictionary
|
||||
|
||||
class OrderedDictionaryTests: XCTestCase {
|
||||
|
||||
var orderedDictionary: OrderedDictionary<String, Int>!
|
||||
// ======================================================= //
|
||||
// MARK: - Initialization
|
||||
// ======================================================= //
|
||||
|
||||
override func setUp() {
|
||||
orderedDictionary = [
|
||||
("A", 1),
|
||||
("B", 2),
|
||||
("C", 3)
|
||||
]
|
||||
func testInitializationUsingArrayLiteral() {
|
||||
let expected = OrderedDictionary<String, Int>(elements: [("A", 1), ("B", 2), ("C", 3)])
|
||||
let actual: OrderedDictionary<String, Int> = [("A", 1), ("B", 2), ("C", 3)]
|
||||
|
||||
XCTAssertTrue(expected == actual)
|
||||
}
|
||||
|
||||
// MARK: - Content
|
||||
|
||||
func testInitializedContent() {
|
||||
expect(self.orderedDictionary.count) == 3
|
||||
func testInitializationUsingDictionaryLiteral() {
|
||||
let expected = OrderedDictionary<String, Int>(elements: [("A", 1), ("B", 2), ("C", 3)])
|
||||
let actual: OrderedDictionary<String, Int> = ["A": 1, "B": 2, "C": 3]
|
||||
|
||||
expect(self.orderedDictionary["A"]) == 1
|
||||
expect(self.orderedDictionary.indexForKey("A")) == 0
|
||||
expect(self.orderedDictionary.containsKey("A")) == true
|
||||
|
||||
expect(self.orderedDictionary["B"]) == 2
|
||||
expect(self.orderedDictionary.indexForKey("B")) == 1
|
||||
expect(self.orderedDictionary.containsKey("B")) == true
|
||||
|
||||
expect(self.orderedDictionary["C"]) == 3
|
||||
expect(self.orderedDictionary.indexForKey("C")) == 2
|
||||
expect(self.orderedDictionary.containsKey("C")) == true
|
||||
XCTAssertTrue(expected == actual)
|
||||
}
|
||||
|
||||
func testInitializationUsingPairs() {
|
||||
let elements = [
|
||||
("A", 1),
|
||||
("B", 2),
|
||||
("C", 3)
|
||||
]
|
||||
|
||||
expect(OrderedDictionary(elements: elements) == self.orderedDictionary).to(beTrue())
|
||||
// ======================================================= //
|
||||
// MARK: - Description
|
||||
// ======================================================= //
|
||||
|
||||
struct DescribedValue: CustomStringConvertible, CustomDebugStringConvertible {
|
||||
init(_ value: Int) { self.value = value }
|
||||
let value: Int
|
||||
var description: String { return "\(value)" }
|
||||
var debugDescription: String { return "debug(\(value))" }
|
||||
}
|
||||
|
||||
func testElementsGenerator() {
|
||||
for entry in self.orderedDictionary.enumerate() {
|
||||
expect(self.orderedDictionary[entry.index].0) == entry.element.0
|
||||
expect(self.orderedDictionary[entry.index].1) == entry.element.1
|
||||
func testDescription() {
|
||||
let expected = "[A: 1, B: 2, C: 3]"
|
||||
|
||||
let orderedDictionary: OrderedDictionary<String, DescribedValue> = ["A": DescribedValue(1), "B": DescribedValue(2), "C": DescribedValue(3)]
|
||||
let actual = orderedDictionary.description
|
||||
|
||||
XCTAssertEqual(expected, actual)
|
||||
}
|
||||
|
||||
func testDebugDescription() {
|
||||
let expected = "[\"A\": debug(1), \"B\": debug(2), \"C\": debug(3)]"
|
||||
|
||||
let orderedDictionary: OrderedDictionary<String, DescribedValue> = ["A": DescribedValue(1), "B": DescribedValue(2), "C": DescribedValue(3)]
|
||||
let actual = orderedDictionary.debugDescription
|
||||
|
||||
XCTAssertEqual(expected, actual)
|
||||
}
|
||||
|
||||
// ======================================================= //
|
||||
// MARK: - Content Access
|
||||
// ======================================================= //
|
||||
|
||||
func testAccessingContent() {
|
||||
let orderedDictionary: OrderedDictionary<String, Int> = ["A": 1, "B": 2, "C": 3]
|
||||
|
||||
XCTAssertEqual(orderedDictionary.count, 3)
|
||||
|
||||
XCTAssertEqual(orderedDictionary["A"], 1)
|
||||
XCTAssertEqual(orderedDictionary.valueForKey("A"), 1)
|
||||
XCTAssertEqual(orderedDictionary.indexForKey("A"), 0)
|
||||
XCTAssertTrue(orderedDictionary.containsKey("A"))
|
||||
XCTAssertTrue(orderedDictionary[0] == ("A", 1))
|
||||
|
||||
XCTAssertEqual(orderedDictionary["B"], 2)
|
||||
XCTAssertEqual(orderedDictionary.valueForKey("B"), 2)
|
||||
XCTAssertEqual(orderedDictionary.indexForKey("B"), 1)
|
||||
XCTAssertTrue(orderedDictionary.containsKey("B"))
|
||||
XCTAssertTrue(orderedDictionary[1] == ("B", 2))
|
||||
|
||||
XCTAssertEqual(orderedDictionary["C"], 3)
|
||||
XCTAssertEqual(orderedDictionary.valueForKey("C"), 3)
|
||||
XCTAssertEqual(orderedDictionary.indexForKey("C"), 2)
|
||||
XCTAssertTrue(orderedDictionary.containsKey("C"))
|
||||
XCTAssertTrue(orderedDictionary[2] == ("C", 3))
|
||||
}
|
||||
|
||||
func testGenerator() {
|
||||
let orderedDictionary: OrderedDictionary<String, Int> = ["A": 1, "B": 2, "C": 3]
|
||||
var generator = orderedDictionary.generate()
|
||||
|
||||
let indexes = [0, 1, 2]
|
||||
var indexesGenerator = indexes.generate()
|
||||
|
||||
while let (actualKey, actualValue) = generator.next() {
|
||||
let index = indexesGenerator.next()
|
||||
let (expectedKey, expectedValue) = orderedDictionary[index!]
|
||||
|
||||
XCTAssertEqual(expectedKey, actualKey)
|
||||
XCTAssertEqual(expectedValue, actualValue)
|
||||
}
|
||||
|
||||
XCTAssertNil(generator.next())
|
||||
XCTAssertNil(indexesGenerator.next())
|
||||
}
|
||||
|
||||
// MARK: - Key-based Modifications
|
||||
|
||||
func testKeyBasedSubscript() {
|
||||
self.orderedDictionary["A"] = 5
|
||||
self.orderedDictionary["D"] = 10
|
||||
self.orderedDictionary["B"] = nil
|
||||
func testOrderedKeys() {
|
||||
let orderedDictionary: OrderedDictionary<String, Int> = ["A": 1, "B": 2, "C": 3]
|
||||
|
||||
expect(self.orderedDictionary.count) == 3
|
||||
let expected = ["A", "B", "C"]
|
||||
let actual = orderedDictionary.orderedKeys
|
||||
|
||||
expect(self.orderedDictionary["A"]) == 5
|
||||
expect(self.orderedDictionary.indexForKey("A")) == 0
|
||||
expect(self.orderedDictionary.containsKey("A")) == true
|
||||
|
||||
expect(self.orderedDictionary["B"]).to(beNil())
|
||||
expect(self.orderedDictionary.indexForKey("B")).to(beNil())
|
||||
expect(self.orderedDictionary.containsKey("B")) == false
|
||||
|
||||
expect(self.orderedDictionary["C"]) == 3
|
||||
expect(self.orderedDictionary.indexForKey("C")) == 1
|
||||
expect(self.orderedDictionary.containsKey("C")) == true
|
||||
|
||||
expect(self.orderedDictionary["D"]) == 10
|
||||
expect(self.orderedDictionary.indexForKey("D")) == 2
|
||||
expect(self.orderedDictionary.containsKey("D")) == true
|
||||
XCTAssertEqual(expected, actual)
|
||||
}
|
||||
|
||||
// MARK: - Index-based Modifications
|
||||
|
||||
func testIndexBasedSubscriptForRetrievingValues() {
|
||||
let elementAtIndex0 = self.orderedDictionary[0]
|
||||
expect(elementAtIndex0.0) == "A"
|
||||
expect(elementAtIndex0.1) == 1
|
||||
func testOrderedValues() {
|
||||
let orderedDictionary: OrderedDictionary<String, Int> = ["A": 1, "B": 2, "C": 3]
|
||||
|
||||
let elementAtIndex1 = self.orderedDictionary[1]
|
||||
expect(elementAtIndex1.0) == "B"
|
||||
expect(elementAtIndex1.1) == 2
|
||||
let expected = [1, 2, 3]
|
||||
let actual = orderedDictionary.orderedValues
|
||||
|
||||
let elementAtIndex2 = self.orderedDictionary[2]
|
||||
expect(elementAtIndex2.0) == "C"
|
||||
expect(elementAtIndex2.1) == 3
|
||||
XCTAssertEqual(expected, actual)
|
||||
}
|
||||
|
||||
func testIndexBasedSubscriptForSettingValues() {
|
||||
self.orderedDictionary[0] = ("F", 10)
|
||||
self.orderedDictionary[1] = ("B", 5)
|
||||
// ======================================================= //
|
||||
// MARK: - Content Modifications
|
||||
// ======================================================= //
|
||||
|
||||
func testKeyBasedModifications() {
|
||||
var orderedDictionary: OrderedDictionary<String, Int> = ["A": 1, "B": 2, "C": 3]
|
||||
|
||||
let elementAtIndex0 = self.orderedDictionary[0]
|
||||
expect(elementAtIndex0.0) == "F"
|
||||
expect(elementAtIndex0.1) == 10
|
||||
orderedDictionary["A"] = 5
|
||||
orderedDictionary["D"] = 10
|
||||
orderedDictionary["B"] = nil
|
||||
|
||||
let elementAtIndex1 = self.orderedDictionary[1]
|
||||
expect(elementAtIndex1.0) == "B"
|
||||
expect(elementAtIndex1.1) == 5
|
||||
XCTAssertEqual(orderedDictionary.count, 3)
|
||||
|
||||
let elementAtIndex2 = self.orderedDictionary[2]
|
||||
expect(elementAtIndex2.0) == "C"
|
||||
expect(elementAtIndex2.1) == 3
|
||||
XCTAssertEqual(orderedDictionary["A"], 5)
|
||||
XCTAssertEqual(orderedDictionary.indexForKey("A"), 0)
|
||||
XCTAssertTrue(orderedDictionary.containsKey("A"))
|
||||
|
||||
XCTAssertNil(orderedDictionary["B"])
|
||||
XCTAssertNil(orderedDictionary.indexForKey("B"))
|
||||
XCTAssertFalse(orderedDictionary.containsKey("B"))
|
||||
|
||||
XCTAssertEqual(orderedDictionary["C"], 3)
|
||||
XCTAssertEqual(orderedDictionary.indexForKey("C"), 1)
|
||||
XCTAssertTrue(orderedDictionary.containsKey("C"))
|
||||
|
||||
XCTAssertEqual(orderedDictionary["D"], 10)
|
||||
XCTAssertEqual(orderedDictionary.indexForKey("D"), 2)
|
||||
XCTAssertTrue(orderedDictionary.containsKey("D"))
|
||||
}
|
||||
|
||||
func testIndexBasedModifications() {
|
||||
var orderedDictionary: OrderedDictionary<String, Int> = ["A": 1, "B": 2, "C": 3]
|
||||
|
||||
orderedDictionary[0] = ("F", 10)
|
||||
orderedDictionary[1] = ("B", 5)
|
||||
|
||||
XCTAssertEqual(orderedDictionary.count, 3)
|
||||
XCTAssertTrue(orderedDictionary[0] == ("F", 10))
|
||||
XCTAssertTrue(orderedDictionary[1] == ("B", 5))
|
||||
XCTAssertTrue(orderedDictionary[2] == ("C", 3))
|
||||
}
|
||||
|
||||
func testRetrievingElementAtNonExistentIndex() {
|
||||
expect(self.orderedDictionary.elementAtIndex(10)).to(beNil())
|
||||
let orderedDictionary: OrderedDictionary<String, Int> = ["A": 1, "B": 2, "C": 3]
|
||||
XCTAssertNil(orderedDictionary.elementAtIndex(42))
|
||||
}
|
||||
|
||||
// MARK: - Removal
|
||||
func testIndexBasedInsertionsOfElementsWithDistinctKeys() {
|
||||
var orderedDictionary: OrderedDictionary<String, Int> = ["A": 1, "B": 2, "C": 3]
|
||||
orderedDictionary.insertElement(("T", 15), atIndex: 0)
|
||||
orderedDictionary.insertElement(("U", 16), atIndex: 2)
|
||||
orderedDictionary.insertElement(("V", 17), atIndex: 5)
|
||||
orderedDictionary.insertElement(("W", 18), atIndex: 2)
|
||||
|
||||
let expected: OrderedDictionary<String, Int> = ["T": 15, "A": 1, "W": 18, "U": 16, "B": 2, "C": 3, "V": 17]
|
||||
let actual = orderedDictionary
|
||||
|
||||
XCTAssertTrue(expected == actual)
|
||||
}
|
||||
|
||||
func testIndexBasedInsertionOfElementWithSameKeyBeforeItsCurrentIndex() {
|
||||
var orderedDictionary: OrderedDictionary<String, Int> = ["A": 1, "B": 2, "C": 3]
|
||||
let previousValue = orderedDictionary.insertElement(("B", 5), atIndex: 0)
|
||||
|
||||
XCTAssertEqual(orderedDictionary.count, 3)
|
||||
XCTAssertEqual(previousValue, 2)
|
||||
|
||||
let expected: OrderedDictionary<String, Int> = ["B": 5, "A": 1, "C": 3]
|
||||
let actual = orderedDictionary
|
||||
|
||||
XCTAssertTrue(expected == actual)
|
||||
}
|
||||
|
||||
func testIndexBasedInsertionOfElementWithSameKeyAtItsCurrentIndex() {
|
||||
var orderedDictionary: OrderedDictionary<String, Int> = ["A": 1, "B": 2, "C": 3]
|
||||
let previousValue = orderedDictionary.insertElement(("B", 5), atIndex: 1)
|
||||
|
||||
XCTAssertEqual(orderedDictionary.count, 3)
|
||||
XCTAssertEqual(previousValue, 2)
|
||||
|
||||
let expected: OrderedDictionary<String, Int> = ["A": 1, "B": 5, "C": 3]
|
||||
let actual = orderedDictionary
|
||||
|
||||
XCTAssertTrue(expected == actual)
|
||||
}
|
||||
|
||||
func testIndexBasedInsertionOfElementWithSameKeyAfterItsCurrentIndex() {
|
||||
var orderedDictionary: OrderedDictionary<String, Int> = ["A": 1, "B": 2, "C": 3]
|
||||
let previousValue = orderedDictionary.insertElement(("B", 5), atIndex: 3)
|
||||
|
||||
XCTAssertEqual(orderedDictionary.count, 3)
|
||||
XCTAssertEqual(previousValue, 2)
|
||||
|
||||
let expected: OrderedDictionary<String, Int> = ["A": 1, "C": 3, "B": 5]
|
||||
let actual = orderedDictionary
|
||||
|
||||
XCTAssertTrue(expected == actual)
|
||||
}
|
||||
|
||||
// ======================================================= //
|
||||
// MARK: - Content Removal
|
||||
// ======================================================= //
|
||||
|
||||
func testRemoveAll() {
|
||||
self.orderedDictionary.removeAll()
|
||||
var orderedDictionary: OrderedDictionary<String, Int> = ["A": 1, "B": 2, "C": 3]
|
||||
|
||||
expect(self.orderedDictionary.count) == 0
|
||||
orderedDictionary.removeAll()
|
||||
|
||||
XCTAssertEqual(orderedDictionary.count, 0)
|
||||
}
|
||||
|
||||
func testRemovalForKey() {
|
||||
let removedValue1 = self.orderedDictionary.removeValueForKey("A")
|
||||
let removedValue2 = self.orderedDictionary.removeValueForKey("K")
|
||||
func testKeyBasedRemoval() {
|
||||
var orderedDictionary: OrderedDictionary<String, Int> = ["A": 1, "B": 2, "C": 3]
|
||||
|
||||
expect(removedValue1) == 1
|
||||
expect(removedValue2).to(beNil())
|
||||
let removedValue1 = orderedDictionary.removeValueForKey("A")
|
||||
let removedValue2 = orderedDictionary.removeValueForKey("K")
|
||||
|
||||
expect(self.orderedDictionary.count) == 2
|
||||
XCTAssertEqual(removedValue1, 1)
|
||||
XCTAssertNil(removedValue2)
|
||||
|
||||
expect(self.orderedDictionary["A"]).to(beNil())
|
||||
expect(self.orderedDictionary.indexForKey("A")).to(beNil())
|
||||
XCTAssertEqual(orderedDictionary.count, 2)
|
||||
|
||||
expect(self.orderedDictionary["B"]) == 2
|
||||
expect(self.orderedDictionary.indexForKey("B")) == 0
|
||||
XCTAssertNil(orderedDictionary["A"])
|
||||
XCTAssertNil(orderedDictionary.indexForKey("A"))
|
||||
|
||||
expect(self.orderedDictionary["C"]) == 3
|
||||
expect(self.orderedDictionary.indexForKey("C")) == 1
|
||||
XCTAssertEqual(orderedDictionary["B"], 2)
|
||||
XCTAssertEqual(orderedDictionary.indexForKey("B"), 0)
|
||||
|
||||
XCTAssertEqual(orderedDictionary["C"], 3)
|
||||
XCTAssertEqual(orderedDictionary.indexForKey("C"), 1)
|
||||
}
|
||||
|
||||
func testIndexBasedRemoval() {
|
||||
var orderedDictionary: OrderedDictionary<String, Int> = ["A": 1, "B": 2, "C": 3, "D": 4]
|
||||
|
||||
let (expectedKey1, expectedValue1) = ("A", 1)
|
||||
let (actualKey1, actualValue1) = orderedDictionary.removeAtIndex(0)!
|
||||
|
||||
XCTAssertEqual(expectedKey1, actualKey1)
|
||||
XCTAssertEqual(expectedValue1, actualValue1)
|
||||
|
||||
let (expectedKey2, expectedValue2) = ("D", 4)
|
||||
let (actualKey2, actualValue2) = orderedDictionary.removeAtIndex(2)!
|
||||
|
||||
XCTAssertEqual(expectedKey2, actualKey2)
|
||||
XCTAssertEqual(expectedValue2, actualValue2)
|
||||
|
||||
let nonExistentElement = orderedDictionary.removeAtIndex(42)
|
||||
|
||||
XCTAssertNil(nonExistentElement)
|
||||
|
||||
let expected: OrderedDictionary<String, Int> = ["B": 2, "C": 3]
|
||||
let actual = orderedDictionary
|
||||
|
||||
XCTAssertTrue(expected == actual)
|
||||
}
|
||||
|
||||
// ======================================================= //
|
||||
// MARK: - Sorting
|
||||
// ======================================================= //
|
||||
|
||||
func testSortingInPlace() {
|
||||
let actual: OrderedDictionary<String, Int> = {
|
||||
var orderedDictionary: OrderedDictionary<String, Int> = ["E": 4, "G": 3, "A": 3, "D": 1, "B": 4]
|
||||
|
||||
orderedDictionary.sortInPlace { (element1: (key: String, value: Int), element2: (key: String, value: Int)) in
|
||||
if element1.value == element2.value {
|
||||
return element1.key < element2.key
|
||||
} else {
|
||||
return element1.value < element2.value
|
||||
}
|
||||
}
|
||||
|
||||
return orderedDictionary
|
||||
}()
|
||||
|
||||
let expected: OrderedDictionary<String, Int> = ["D": 1, "A": 3, "G": 3, "B": 4, "E": 4]
|
||||
|
||||
XCTAssertTrue(actual == expected)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func testRemovalAtIndex() {
|
||||
let removedElement1 = self.orderedDictionary.removeAtIndex(1)
|
||||
let removedElement2 = self.orderedDictionary.removeAtIndex(0)
|
||||
let removedElement3 = self.orderedDictionary.removeAtIndex(5)
|
||||
|
||||
expect(removedElement1?.0) == "B"
|
||||
expect(removedElement1?.1) == 2
|
||||
|
||||
expect(removedElement2?.0) == "A"
|
||||
expect(removedElement2?.1) == 1
|
||||
|
||||
expect(removedElement3).to(beNil())
|
||||
|
||||
expect(self.orderedDictionary.count) == 1
|
||||
|
||||
let elementAtIndex0 = self.orderedDictionary[0]
|
||||
expect(elementAtIndex0.0) == "C"
|
||||
expect(elementAtIndex0.1) == 3
|
||||
}
|
||||
|
||||
// MARK: - Description
|
||||
|
||||
func testDescription() {
|
||||
expect(self.orderedDictionary.description) == "[A: 1, B: 2, C: 3]"
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user