Commit 454a9c3e authored by Dapperstout's avatar Dapperstout

Use extracted 'SwiftBytes' library.

parent 46391c96
......@@ -4,6 +4,7 @@ platform :ios, '8.0'
link_with 'Pulse', 'PulseTests', 'PulseIntegrationTests'
use_frameworks!
pod 'SwiftBytes', '~> 0.1.0'
pod 'CocoaAsyncSocket', '~> 7.4', :inhibit_warnings => true
pod 'lz4', '~> 123'
pod 'Base32', '~> 1.0.2'
......
......@@ -4,6 +4,7 @@ PODS:
- IGDigest (1.1.2)
- lz4 (123)
- OpenSSL-Framework (1.0.2)
- SwiftBytes (0.1.0)
DEPENDENCIES:
- Base32 (~> 1.0.2)
......@@ -11,6 +12,7 @@ DEPENDENCIES:
- IGDigest (~> 1.1.0)
- lz4 (~> 123)
- OpenSSL-Framework (~> 1.0.2)
- SwiftBytes (~> 0.1.0)
SPEC CHECKSUMS:
Base32: a0ef6e90e721130c474cc970a4d98a6cbf16ce85
......@@ -18,5 +20,6 @@ SPEC CHECKSUMS:
IGDigest: b9ff1800bf1f0bdc3714fb4f0f63904464b2ddb4
lz4: 316468bb1b748b046e7d4452e46ffc5c7fddccf0
OpenSSL-Framework: b1654dc18ef9a08ee7670c690a5e9795b44ce28d
SwiftBytes: 2f33be5dd47e9cee01aae1ccd54c126ea1ab5a6e
COCOAPODS: 0.36.0.rc.1
{
"name": "SwiftBytes",
"version": "0.1.0",
"summary": "Collection of helper methods for byte manipulation in Swift",
"description": " This library contains a collection of helper methods for\n byte manipulation in Swift.\n\n If you're like me, and can never remember whether you should\n double right-shift or tripple left-shift to get to the\n bits you want, then this library might be of some use to\n you.\n",
"homepage": "https://github.com/dapperstout/swift-bytes",
"license": {
"type": "MIT"
},
"authors": "Dapperstout",
"source": {
"git": "https://github.com/dapperstout/swift-bytes.git",
"tag": "0.1.0"
},
"platforms": {
"ios": "8.0",
"osx": "10.9"
},
"source_files": "Bytes/Bytes/**/*.swift",
"requires_arc": true
}
......@@ -4,6 +4,7 @@ PODS:
- IGDigest (1.1.2)
- lz4 (123)
- OpenSSL-Framework (1.0.2)
- SwiftBytes (0.1.0)
DEPENDENCIES:
- Base32 (~> 1.0.2)
......@@ -11,6 +12,7 @@ DEPENDENCIES:
- IGDigest (~> 1.1.0)
- lz4 (~> 123)
- OpenSSL-Framework (~> 1.0.2)
- SwiftBytes (~> 0.1.0)
SPEC CHECKSUMS:
Base32: a0ef6e90e721130c474cc970a4d98a6cbf16ce85
......@@ -18,5 +20,6 @@ SPEC CHECKSUMS:
IGDigest: b9ff1800bf1f0bdc3714fb4f0f63904464b2ddb4
lz4: 316468bb1b748b046e7d4452e46ffc5c7fddccf0
OpenSSL-Framework: b1654dc18ef9a08ee7670c690a5e9795b44ce28d
SwiftBytes: 2f33be5dd47e9cee01aae1ccd54c126ea1ab5a6e
COCOAPODS: 0.36.0.rc.1
This source diff could not be displayed because it is too large. You can view the blob instead.
Copyright (c) 2015 dapperstout
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
Swift Bytes
===========
This library contains a collection of helper methods for byte manipulation in Swift.
If you're like me, and can never remember whether you should double right-shift or tripple left-shift to get to the bits you want, then this library might be of some use to you.
Example
-------
// Let's say we have an interesting 64 bit number:
let largeNumber: UInt64 = 0xF00FA00AB00BC00C
// Extracting the fifth byte, the hard way:
let fifthByte = UInt8((largeNumber >> 24) & 0xFF)
// Extracting the fifth byte using this libary:
let fifthByte = bytes(largeNumber)[4]
All available byte manipulation methods can be found in the `Bytes.swift` file. The `BytesTests.swift` file contains examples of their use.
Installation
------------
You can use [CocoaPods] to add this library to your project. Use the following in your Podfile:
pod 'swift-bytes'
After adding this library to your project, you can import it in your swift files:
import Bytes
[CocoaPods]: http://cocoapods.org
......@@ -2,7 +2,7 @@
CONFIGURATION_BUILD_DIR = $PODS_FRAMEWORK_BUILD_PATH
FRAMEWORK_SEARCH_PATHS = "$PODS_FRAMEWORK_BUILD_PATH"
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/Base32" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/Base32" "${PODS_ROOT}/Headers/Public/CocoaAsyncSocket" "${PODS_ROOT}/Headers/Public/IGDigest" "${PODS_ROOT}/Headers/Public/OpenSSL-Framework" "${PODS_ROOT}/Headers/Public/lz4"
HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/Base32" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/Base32" "${PODS_ROOT}/Headers/Public/CocoaAsyncSocket" "${PODS_ROOT}/Headers/Public/IGDigest" "${PODS_ROOT}/Headers/Public/OpenSSL-Framework" "${PODS_ROOT}/Headers/Public/SwiftBytes" "${PODS_ROOT}/Headers/Public/lz4"
OTHER_LDFLAGS = -ObjC
PODS_FRAMEWORK_BUILD_PATH = $(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/Pods
PODS_ROOT = ${SRCROOT}
......
......@@ -2,7 +2,7 @@
CONFIGURATION_BUILD_DIR = $PODS_FRAMEWORK_BUILD_PATH
FRAMEWORK_SEARCH_PATHS = "$PODS_FRAMEWORK_BUILD_PATH"
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/CocoaAsyncSocket" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/Base32" "${PODS_ROOT}/Headers/Public/CocoaAsyncSocket" "${PODS_ROOT}/Headers/Public/IGDigest" "${PODS_ROOT}/Headers/Public/OpenSSL-Framework" "${PODS_ROOT}/Headers/Public/lz4"
HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/CocoaAsyncSocket" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/Base32" "${PODS_ROOT}/Headers/Public/CocoaAsyncSocket" "${PODS_ROOT}/Headers/Public/IGDigest" "${PODS_ROOT}/Headers/Public/OpenSSL-Framework" "${PODS_ROOT}/Headers/Public/SwiftBytes" "${PODS_ROOT}/Headers/Public/lz4"
OTHER_LDFLAGS = ${PODS_COCOAASYNCSOCKET_OTHER_LDFLAGS} -ObjC
PODS_FRAMEWORK_BUILD_PATH = $(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/Pods
PODS_ROOT = ${SRCROOT}
......
......@@ -2,7 +2,7 @@
CONFIGURATION_BUILD_DIR = $PODS_FRAMEWORK_BUILD_PATH
FRAMEWORK_SEARCH_PATHS = "$PODS_FRAMEWORK_BUILD_PATH"
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/IGDigest" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/Base32" "${PODS_ROOT}/Headers/Public/CocoaAsyncSocket" "${PODS_ROOT}/Headers/Public/IGDigest" "${PODS_ROOT}/Headers/Public/OpenSSL-Framework" "${PODS_ROOT}/Headers/Public/lz4"
HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/IGDigest" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/Base32" "${PODS_ROOT}/Headers/Public/CocoaAsyncSocket" "${PODS_ROOT}/Headers/Public/IGDigest" "${PODS_ROOT}/Headers/Public/OpenSSL-Framework" "${PODS_ROOT}/Headers/Public/SwiftBytes" "${PODS_ROOT}/Headers/Public/lz4"
OTHER_LDFLAGS = -ObjC
PODS_FRAMEWORK_BUILD_PATH = $(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/Pods
PODS_ROOT = ${SRCROOT}
......
<?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>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIdentifier</key>
<string>org.cocoapods.${PRODUCT_NAME:rfc1034identifier}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>0.1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>${CURRENT_PROJECT_VERSION}</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>
</plist>
#include "Pods-SwiftBytes.xcconfig"
CONFIGURATION_BUILD_DIR = $PODS_FRAMEWORK_BUILD_PATH
FRAMEWORK_SEARCH_PATHS = "$PODS_FRAMEWORK_BUILD_PATH"
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/SwiftBytes" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/Base32" "${PODS_ROOT}/Headers/Public/CocoaAsyncSocket" "${PODS_ROOT}/Headers/Public/IGDigest" "${PODS_ROOT}/Headers/Public/OpenSSL-Framework" "${PODS_ROOT}/Headers/Public/SwiftBytes" "${PODS_ROOT}/Headers/Public/lz4"
OTHER_LDFLAGS = -ObjC
OTHER_SWIFT_FLAGS = "-D" "COCOAPODS"
PODS_FRAMEWORK_BUILD_PATH = $(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/Pods
PODS_ROOT = ${SRCROOT}
SKIP_INSTALL = YES
\ No newline at end of file
#import <Foundation/Foundation.h>
@interface PodsDummy_Pods_SwiftBytes : NSObject
@end
@implementation PodsDummy_Pods_SwiftBytes
@end
#ifdef __OBJC__
#import <UIKit/UIKit.h>
#endif
#import "Pods-environment.h"
#import <UIKit/UIKit.h>
FOUNDATION_EXPORT double SwiftBytesVersionNumber;
FOUNDATION_EXPORT const unsigned char SwiftBytesVersionString[];
framework module SwiftBytes {
umbrella header "Pods-SwiftBytes-umbrella.h"
export *
module * { export * }
}
......@@ -2,7 +2,7 @@
CONFIGURATION_BUILD_DIR = $PODS_FRAMEWORK_BUILD_PATH
FRAMEWORK_SEARCH_PATHS = "$PODS_FRAMEWORK_BUILD_PATH"
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/lz4" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/Base32" "${PODS_ROOT}/Headers/Public/CocoaAsyncSocket" "${PODS_ROOT}/Headers/Public/IGDigest" "${PODS_ROOT}/Headers/Public/OpenSSL-Framework" "${PODS_ROOT}/Headers/Public/lz4"
HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/lz4" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/Base32" "${PODS_ROOT}/Headers/Public/CocoaAsyncSocket" "${PODS_ROOT}/Headers/Public/IGDigest" "${PODS_ROOT}/Headers/Public/OpenSSL-Framework" "${PODS_ROOT}/Headers/Public/SwiftBytes" "${PODS_ROOT}/Headers/Public/lz4"
OTHER_LDFLAGS = -ObjC
PODS_FRAMEWORK_BUILD_PATH = $(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/Pods
PODS_ROOT = ${SRCROOT}
......
......@@ -165,6 +165,26 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
## SwiftBytes
Copyright (c) 2015 dapperstout
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
## lz4
LZ4 Library
......
......@@ -188,6 +188,30 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.</string>
<key>Type</key>
<string>PSGroupSpecifier</string>
</dict>
<dict>
<key>FooterText</key>
<string>Copyright (c) 2015 dapperstout
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
</string>
<key>Title</key>
<string>SwiftBytes</string>
<key>Type</key>
<string>PSGroupSpecifier</string>
</dict>
<dict>
<key>FooterText</key>
<string>LZ4 Library
......
......@@ -30,6 +30,12 @@
#define COCOAPODS_VERSION_MINOR_OpenSSL_Framework 0
#define COCOAPODS_VERSION_PATCH_OpenSSL_Framework 2
// SwiftBytes
#define COCOAPODS_POD_AVAILABLE_SwiftBytes
#define COCOAPODS_VERSION_MAJOR_SwiftBytes 0
#define COCOAPODS_VERSION_MINOR_SwiftBytes 1
#define COCOAPODS_VERSION_PATCH_SwiftBytes 0
// lz4
#define COCOAPODS_POD_AVAILABLE_lz4
#define COCOAPODS_VERSION_MAJOR_lz4 123
......
......@@ -51,11 +51,13 @@ if [[ "$CONFIGURATION" == "Debug" ]]; then
install_framework 'Base32.framework'
install_framework 'CocoaAsyncSocket.framework'
install_framework 'IGDigest.framework'
install_framework 'SwiftBytes.framework'
install_framework 'lz4.framework'
fi
if [[ "$CONFIGURATION" == "Release" ]]; then
install_framework 'Base32.framework'
install_framework 'CocoaAsyncSocket.framework'
install_framework 'IGDigest.framework'
install_framework 'SwiftBytes.framework'
install_framework 'lz4.framework'
fi
FRAMEWORK_SEARCH_PATHS = "$PODS_FRAMEWORK_BUILD_PATH" "$(PODS_ROOT)/OpenSSL-Framework"
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks'
OTHER_CFLAGS = $(inherited) -iquote "$PODS_FRAMEWORK_BUILD_PATH/Base32.framework/Headers" -iquote "$PODS_FRAMEWORK_BUILD_PATH/CocoaAsyncSocket.framework/Headers" -iquote "$PODS_FRAMEWORK_BUILD_PATH/IGDigest.framework/Headers" -iquote "$PODS_FRAMEWORK_BUILD_PATH/OpenSSL_Framework.framework/Headers" -iquote "$PODS_FRAMEWORK_BUILD_PATH/lz4.framework/Headers"
OTHER_LDFLAGS = $(inherited) -ObjC -framework "Base32" -framework "CocoaAsyncSocket" -framework "IGDigest" -framework "lz4" -framework "openssl"
OTHER_CFLAGS = $(inherited) -iquote "$PODS_FRAMEWORK_BUILD_PATH/Base32.framework/Headers" -iquote "$PODS_FRAMEWORK_BUILD_PATH/CocoaAsyncSocket.framework/Headers" -iquote "$PODS_FRAMEWORK_BUILD_PATH/IGDigest.framework/Headers" -iquote "$PODS_FRAMEWORK_BUILD_PATH/OpenSSL_Framework.framework/Headers" -iquote "$PODS_FRAMEWORK_BUILD_PATH/SwiftBytes.framework/Headers" -iquote "$PODS_FRAMEWORK_BUILD_PATH/lz4.framework/Headers"
OTHER_LDFLAGS = $(inherited) -ObjC -framework "Base32" -framework "CocoaAsyncSocket" -framework "IGDigest" -framework "SwiftBytes" -framework "lz4" -framework "openssl"
OTHER_LIBTOOLFLAGS = $(OTHER_LDFLAGS)
OTHER_SWIFT_FLAGS = "-D" "COCOAPODS"
PODS_FRAMEWORK_BUILD_PATH = $(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/Pods
PODS_ROOT = ${SRCROOT}/Pods
\ No newline at end of file
FRAMEWORK_SEARCH_PATHS = "$PODS_FRAMEWORK_BUILD_PATH" "$(PODS_ROOT)/OpenSSL-Framework"
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks'
OTHER_CFLAGS = $(inherited) -iquote "$PODS_FRAMEWORK_BUILD_PATH/Base32.framework/Headers" -iquote "$PODS_FRAMEWORK_BUILD_PATH/CocoaAsyncSocket.framework/Headers" -iquote "$PODS_FRAMEWORK_BUILD_PATH/IGDigest.framework/Headers" -iquote "$PODS_FRAMEWORK_BUILD_PATH/OpenSSL_Framework.framework/Headers" -iquote "$PODS_FRAMEWORK_BUILD_PATH/lz4.framework/Headers"
OTHER_LDFLAGS = $(inherited) -ObjC -framework "Base32" -framework "CocoaAsyncSocket" -framework "IGDigest" -framework "lz4" -framework "openssl"
OTHER_CFLAGS = $(inherited) -iquote "$PODS_FRAMEWORK_BUILD_PATH/Base32.framework/Headers" -iquote "$PODS_FRAMEWORK_BUILD_PATH/CocoaAsyncSocket.framework/Headers" -iquote "$PODS_FRAMEWORK_BUILD_PATH/IGDigest.framework/Headers" -iquote "$PODS_FRAMEWORK_BUILD_PATH/OpenSSL_Framework.framework/Headers" -iquote "$PODS_FRAMEWORK_BUILD_PATH/SwiftBytes.framework/Headers" -iquote "$PODS_FRAMEWORK_BUILD_PATH/lz4.framework/Headers"
OTHER_LDFLAGS = $(inherited) -ObjC -framework "Base32" -framework "CocoaAsyncSocket" -framework "IGDigest" -framework "SwiftBytes" -framework "lz4" -framework "openssl"
OTHER_LIBTOOLFLAGS = $(OTHER_LDFLAGS)
OTHER_SWIFT_FLAGS = "-D" "COCOAPODS"
PODS_FRAMEWORK_BUILD_PATH = $(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/Pods
PODS_ROOT = ${SRCROOT}/Pods
\ No newline at end of file
......@@ -27,7 +27,6 @@
4D6A477219E860CF005D7C23 /* Request.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4D6A476219E860CF005D7C23 /* Request.swift */; };
4D6A477319E860CF005D7C23 /* Response.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4D6A476319E860CF005D7C23 /* Response.swift */; };
4D6A477619E860CF005D7C23 /* Pulse.h in Headers */ = {isa = PBXBuildFile; fileRef = 4D6A476619E860CF005D7C23 /* Pulse.h */; settings = {ATTRIBUTES = (Public, ); }; };
4D6A478819E860E4005D7C23 /* BytesTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4D6A477A19E860E4005D7C23 /* BytesTests.swift */; };
4D6A478919E860E4005D7C23 /* LZ4CompressionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4D6A477B19E860E4005D7C23 /* LZ4CompressionTests.swift */; };
4D6A478A19E860E4005D7C23 /* XdrReaderTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4D6A477C19E860E4005D7C23 /* XdrReaderTests.swift */; };
4D6A478B19E860E4005D7C23 /* XdrTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4D6A477D19E860E4005D7C23 /* XdrTests.swift */; };
......@@ -38,7 +37,6 @@
4D6A479219E860E4005D7C23 /* RequestTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4D6A478519E860E4005D7C23 /* RequestTests.swift */; };
4D6A479319E860E4005D7C23 /* ResponseTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4D6A478619E860E4005D7C23 /* ResponseTests.swift */; };
4D6A479919E86877005D7C23 /* Pong.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4D6A476119E860CF005D7C23 /* Pong.swift */; };
4D6A479F19E868AD005D7C23 /* Bytes.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4D6A479B19E868AD005D7C23 /* Bytes.swift */; };
4D6A47A019E868AD005D7C23 /* LZ4Compression.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4D6A479C19E868AD005D7C23 /* LZ4Compression.swift */; };
4D6A47A119E868AD005D7C23 /* Utf8.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4D6A479D19E868AD005D7C23 /* Utf8.swift */; };
4D6A47A219E868AD005D7C23 /* Xdr.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4D6A479E19E868AD005D7C23 /* Xdr.swift */; };
......@@ -128,7 +126,6 @@
4D6A476319E860CF005D7C23 /* Response.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Response.swift; sourceTree = "<group>"; };
4D6A476419E860CF005D7C23 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
4D6A476619E860CF005D7C23 /* Pulse.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Pulse.h; sourceTree = "<group>"; };
4D6A477A19E860E4005D7C23 /* BytesTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BytesTests.swift; sourceTree = "<group>"; };
4D6A477B19E860E4005D7C23 /* LZ4CompressionTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LZ4CompressionTests.swift; sourceTree = "<group>"; };
4D6A477C19E860E4005D7C23 /* XdrReaderTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = XdrReaderTests.swift; sourceTree = "<group>"; };
4D6A477D19E860E4005D7C23 /* XdrTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = XdrTests.swift; sourceTree = "<group>"; };
......@@ -140,7 +137,6 @@
4D6A478519E860E4005D7C23 /* RequestTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RequestTests.swift; sourceTree = "<group>"; };
4D6A478619E860E4005D7C23 /* ResponseTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ResponseTests.swift; sourceTree = "<group>"; };
4D6A478719E860E4005D7C23 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
4D6A479B19E868AD005D7C23 /* Bytes.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Bytes.swift; sourceTree = "<group>"; };
4D6A479C19E868AD005D7C23 /* LZ4Compression.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LZ4Compression.swift; sourceTree = "<group>"; };
4D6A479D19E868AD005D7C23 /* Utf8.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Utf8.swift; sourceTree = "<group>"; };
4D6A479E19E868AD005D7C23 /* Xdr.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Xdr.swift; sourceTree = "<group>"; };
......@@ -261,7 +257,6 @@
4D6A475519E860CF005D7C23 /* util */ = {
isa = PBXGroup;
children = (
4D6A479B19E868AD005D7C23 /* Bytes.swift */,
4D6A479C19E868AD005D7C23 /* LZ4Compression.swift */,
4D6A479D19E868AD005D7C23 /* Utf8.swift */,
4D6A479E19E868AD005D7C23 /* Xdr.swift */,
......@@ -320,7 +315,6 @@
4D6A477919E860E4005D7C23 /* util */ = {
isa = PBXGroup;
children = (
4D6A477A19E860E4005D7C23 /* BytesTests.swift */,
4D6A477B19E860E4005D7C23 /* LZ4CompressionTests.swift */,
4D6A477C19E860E4005D7C23 /* XdrReaderTests.swift */,
4D6A477D19E860E4005D7C23 /* XdrTests.swift */,
......@@ -734,7 +728,6 @@
4D90356A19F70CE8009C9A34 /* FileInfo.swift in Sources */,
4D11A2C719EACC33002C6861 /* Folder.swift in Sources */,
4D9D5A5B19F533F70058D1B8 /* Options.swift in Sources */,
4D6A479F19E868AD005D7C23 /* Bytes.swift in Sources */,
4D6A477019E860CF005D7C23 /* Ping.swift in Sources */,
4D6A47A119E868AD005D7C23 /* Utf8.swift in Sources */,
4D6A479919E86877005D7C23 /* Pong.swift in Sources */,
......@@ -770,7 +763,6 @@
4D11A2C919EACC5A002C6861 /* FolderTests.swift in Sources */,
4D9D5A5D19F53AD50058D1B8 /* ClusterConfigTests.swift in Sources */,
4D6A478D19E860E4005D7C23 /* CloseTests.swift in Sources */,
4D6A478819E860E4005D7C23 /* BytesTests.swift in Sources */,
4D90356C19F918FF009C9A34 /* IndexUpdateTests.swift in Sources */,
4D6A478A19E860E4005D7C23 /* XdrReaderTests.swift in Sources */,
4D213DE419F6F7FB005DAE61 /* IndexTests.swift in Sources */,
......
import Foundation
import SwiftBytes
public class Connector: NSObject {
......
import Foundation
import SwiftBytes
public func compress(uncompressed : [UInt8]) -> [UInt8] {
let lengthBytes = bytes(UInt32(uncompressed.count))
......
import Foundation
import SwiftBytes
public class XdrReader {
......
import Foundation
import SwiftBytes
public class XdrWriter {
......
import Foundation
import SwiftBytes
public class Device : Equatable, XdrWritable, XdrReadable {
......
import Foundation
import SwiftBytes
public class EncodedMessage {
public let id: UInt16
......
import Foundation
import SwiftBytes
public class FileInfo : Equatable, XdrWritable, XdrReadable {
......
import XCTest
import Pulse
import SwiftBytes
func createTestDeviceId(desc:String) -> DeviceId {
return DeviceId(cert:SecIdentity.create(numberOfBits:512, error:nil)!.certificate!)
......
import XCTest
import Pulse
class BytesTest: XCTestCase {
func testDecompositionOfByteIntoBits() {
let eightBits = bits(0b10101010)
XCTAssertEqual(eightBits, [true, false, true, false, true, false, true, false])
}
func testDecompositionOfByteIntoNibbles() {
XCTAssertEqual(nibbles(0b1010_0101), [0b1010, 0b0101]);
}
func testDecompositionOfShortIntoBytes() {
XCTAssertEqual(bytes(UInt16(0b10101010_01010101)), [0b10101010, 0b01010101])
}
func testDecompositionOfUInt32IntoBytes() {
let uint32: UInt32 = 0xF00FA00A
XCTAssertEqual(bytes(uint32), [0xF0, 0x0F, 0xA0, 0x0A])
}
func testDecompositionOfUInt64IntoBytes() {
let uint64: UInt64 = 0xF00FA00AB00BC00C
XCTAssertEqual(
bytes(uint64),
[0xF0, 0x0F, 0xA0, 0x0A, 0xB0, 0x0B, 0xC0, 0x0C]
)
}
func testConcatenationOfBitsIntoByte() {
let eightBits = [true, false, true, false, true, false, true, false]
XCTAssertEqual(concatenateBits(eightBits), UInt8(0b10101010))
}
func testConcatenationOfNibblesIntoByte() {
let left = UInt8(0b1010)
let right = UInt8(0b0101)
XCTAssertEqual(concatenateNibbles(left, right), UInt8(0b1010_0101))
}
func testConcatenationOfBytesIntoShort() {
let left = UInt8(0b10101010)
let right = UInt8(0b01010101)
XCTAssertEqual(concatenateBytes(left, right), UInt16(0b10101010_01010101))
}
func testConcatenationOfBytesIntoUInt32() {
let b0 = UInt8(0xF0)
let b1 = UInt8(0x0F)
let b2 = UInt8(0xA0)
let b3 = UInt8(0x0A)
let expected: UInt32 = 0xF00FA00A
XCTAssertEqual(concatenateBytes(b0, b1, b2, b3), expected)
}
func testConcatenationOfBytesIntoUInt64() {
let b0 = UInt8(0xF0)
let b1 = UInt8(0x0F)
let b2 = UInt8(0xA0)
let b3 = UInt8(0x0A)
let b4 = UInt8(0xB0)
let b5 = UInt8(0x0B)
let b6 = UInt8(0xC0)
let b7 = UInt8(0x0C)
let expected: UInt64 = 0xF00FA00AB00BC00C
XCTAssertEqual(concatenateBytes(b0, b1, b2, b3, b4, b5, b6, b7), expected)
}
func testUnsignedByte() {
let signed = Int8(bitPattern: 0xFF)
XCTAssertEqual(unsigned(signed), UInt8(0xFF))
}
func testUnsignedInt32() {
let signed = Int32(bitPattern: 0xF00FA00A)
let expected: UInt32 = 0xF00FA00A
XCTAssertEqual(unsigned(signed), expected)
}
func testUnsignedInt64() {
let signed = Int64(bitPattern: 0xF00FA00AB00BC00C)
let expected: UInt64 = 0xF00FA00AB00BC00C
XCTAssertEqual(unsigned(signed), expected)
}
func testUnsignedArray() {
let signed = [Int8(bitPattern: 0xF0), Int8(bitPattern: 0x0F)]
XCTAssertEqual(unsigned(signed), [0xF0, 0x0F])
}
func testSignedByte() {
let unsigned = UInt8(0xFF)
XCTAssertEqual(signed(unsigned), Int8(bitPattern: 0xFF))
}
func testSignedInt32() {
let unsigned: UInt32 = 0xF00FA00A
XCTAssertEqual(signed(unsigned), Int32(bitPattern: 0xF00FA00A))
}
func testSignedInt64() {
let unsigned: UInt64 = 0xF00FA00AB00BC00C
XCTAssertEqual(signed(unsigned), Int64(bitPattern: 0xF00FA00AB00BC00C))
}
func testSignedArray() {
let unsigned: [UInt8] = [0xF0, 0x0F]
XCTAssertEqual(signed(unsigned), [signed(0xF0), signed(0x0F)])
}
func testConversionToNSData() {
let bytes: [UInt8] = [1, 2, 3]
let data = NSData(bytes: bytes)
XCTAssertEqual(data, NSData(bytes: bytes, length: Int(bytes.count)))
}
func testConversionFromNSData() {
let bytes: [UInt8] = [1, 2, 3]
let data = NSData(bytes: bytes)
XCTAssertEqual(data.bytes, bytes)
}
}
import XCTest
import Pulse
import SwiftBytes
class LZ4CompressionTests : XCTestCase {
......
import XCTest
import Pulse
import SwiftBytes
class XdrWriterTests : XCTestCase {
......
import XCTest
import Pulse
import SwiftBytes
class DeviceTests : XCTestCase {
......
import XCTest
import Pulse
import SwiftBytes
class EncodedMessageDeserializationTests: XCTestCase {
......
import XCTest
import Pulse
import SwiftBytes
class EncodedMessageTests: XCTestCase {
......
import XCTest
import Pulse
import SwiftBytes
class FileInfoTests: XCTestCase {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment