Skip to content

Commit

Permalink
Update demo
Browse files Browse the repository at this point in the history
  • Loading branch information
daisuke-t-jp committed Sep 22, 2020
1 parent 04fcf11 commit 6adc031
Show file tree
Hide file tree
Showing 14 changed files with 184 additions and 195 deletions.
100 changes: 50 additions & 50 deletions Demo/Common.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,55 +11,55 @@ import Foundation
import FNV

class Common {

static func test() {
print("fnv0_32(\"Hello World!\") -> \(FNV.FNV0_32.digestHex("Hello World!"))")
print("fnv0_64(\"Hello World!\") -> \(FNV.FNV0_64.digestHex("Hello World!"))")
print("fnv1_32(\"Hello World!\") -> \(FNV.FNV1_32.digestHex("Hello World!"))")
print("fnv1_64(\"Hello World!\") -> \(FNV.FNV1_64.digestHex("Hello World!"))")
print("fnv1a_32(\"Hello World!\") -> \(FNV.FNV1a_32.digestHex("Hello World!"))")
print("fnv1a_64(\"Hello World!\") -> \(FNV.FNV1a_64.digestHex("Hello World!"))")


let bundle = Bundle(for: Common.self)
let path = bundle.path(forResource: "alice29", ofType: "txt")!
let data = NSData(contentsOfFile: path)! as Data

let fnv0_32 = FNV.FNV0_32()
let fnv0_64 = FNV.FNV0_64()
let fnv1_32 = FNV.FNV1_32()
let fnv1_64 = FNV.FNV1_64()
let fnv1a_32 = FNV.FNV1a_32()
let fnv1a_64 = FNV.FNV1a_64()

let bufSize = 1024
var index = 0

repeat {
var lastIndex = index + bufSize
if lastIndex > data.count {
lastIndex = index + data.count - index
}

let data2 = data[index..<lastIndex]
fnv0_32.update(data2)
fnv0_64.update(data2)
fnv1_32.update(data2)
fnv1_64.update(data2)
fnv1a_32.update(data2)
fnv1a_64.update(data2)

index += data2.count
if index >= data.count {
break
}
} while(true)

print("fnv0_32(file) -> \(fnv0_32.digestHex())")
print("fnv0_64(file) -> \(fnv0_64.digestHex())")
print("fnv1_32(file) -> \(fnv1_32.digestHex())")
print("fnv1_64(file) -> \(fnv1_64.digestHex())")
print("fnv1a_32(file) -> \(fnv1a_32.digestHex())")
print("fnv1a_64(file) -> \(fnv1a_64.digestHex())")
}
static func test() {
print("fnv0_32(\"Hello World!\") -> \(FNV.FNV0_32.digestHex("Hello World!"))")
print("fnv0_64(\"Hello World!\") -> \(FNV.FNV0_64.digestHex("Hello World!"))")
print("fnv1_32(\"Hello World!\") -> \(FNV.FNV1_32.digestHex("Hello World!"))")
print("fnv1_64(\"Hello World!\") -> \(FNV.FNV1_64.digestHex("Hello World!"))")
print("fnv1a_32(\"Hello World!\") -> \(FNV.FNV1a_32.digestHex("Hello World!"))")
print("fnv1a_64(\"Hello World!\") -> \(FNV.FNV1a_64.digestHex("Hello World!"))")


let bundle = Bundle(for: Common.self)
let path = bundle.path(forResource: "alice29", ofType: "txt")!
let data = NSData(contentsOfFile: path)! as Data

let fnv0_32 = FNV.FNV0_32()
let fnv0_64 = FNV.FNV0_64()
let fnv1_32 = FNV.FNV1_32()
let fnv1_64 = FNV.FNV1_64()
let fnv1a_32 = FNV.FNV1a_32()
let fnv1a_64 = FNV.FNV1a_64()

let bufSize = 1024
var index = 0

repeat {
var lastIndex = index + bufSize
if lastIndex > data.count {
lastIndex = index + data.count - index
}

let data2 = data[index..<lastIndex]
fnv0_32.update(data2)
fnv0_64.update(data2)
fnv1_32.update(data2)
fnv1_64.update(data2)
fnv1a_32.update(data2)
fnv1a_64.update(data2)

index += data2.count
if index >= data.count {
break
}
} while(true)

print("fnv0_32(file) -> \(fnv0_32.digestHex())")
print("fnv0_64(file) -> \(fnv0_64.digestHex())")
print("fnv1_32(file) -> \(fnv1_32.digestHex())")
print("fnv1_64(file) -> \(fnv1_64.digestHex())")
print("fnv1a_32(file) -> \(fnv1a_32.digestHex())")
print("fnv1a_64(file) -> \(fnv1a_64.digestHex())")
}
}
17 changes: 8 additions & 9 deletions Demo/FNVDemoMacOS/FNVDemoMacOS.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 50;
objectVersion = 51;
objects = {

/* Begin PBXBuildFile section */
Expand Down Expand Up @@ -122,7 +122,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 1010;
LastUpgradeCheck = 1010;
LastUpgradeCheck = 1200;
ORGANIZATIONNAME = FNVDemoMacOS;
TargetAttributes = {
021493A02209128700B7DBF2 = {
Expand Down Expand Up @@ -191,16 +191,11 @@
files = (
);
inputFileListPaths = (
);
inputPaths = (
"${PODS_ROOT}/Target Support Files/Pods-FNVDemoMacOS/Pods-FNVDemoMacOS-frameworks.sh",
"${BUILT_PRODUCTS_DIR}/FNV/FNV.framework",
"${PODS_ROOT}/Target Support Files/Pods-FNVDemoMacOS/Pods-FNVDemoMacOS-frameworks-${CONFIGURATION}-input-files.xcfilelist",
);
name = "[CP] Embed Pods Frameworks";
outputFileListPaths = (
);
outputPaths = (
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FNV.framework",
"${PODS_ROOT}/Target Support Files/Pods-FNVDemoMacOS/Pods-FNVDemoMacOS-frameworks-${CONFIGURATION}-output-files.xcfilelist",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
Expand Down Expand Up @@ -260,6 +255,7 @@
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
Expand Down Expand Up @@ -321,6 +317,7 @@
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
Expand Down Expand Up @@ -355,6 +352,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_ENTITLEMENTS = FNVDemoMacOS/FNVDemoMacOS.entitlements;
CODE_SIGN_IDENTITY = "-";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
INFOPLIST_FILE = FNVDemoMacOS/Info.plist;
Expand All @@ -374,6 +372,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_ENTITLEMENTS = FNVDemoMacOS/FNVDemoMacOS.entitlements;
CODE_SIGN_IDENTITY = "-";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
INFOPLIST_FILE = FNVDemoMacOS/Info.plist;
Expand Down
24 changes: 12 additions & 12 deletions Demo/FNVDemoMacOS/FNVDemoMacOS/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@ import Cocoa

@NSApplicationMain
class AppDelegate: NSObject, NSApplicationDelegate {



func applicationDidFinishLaunching(_ aNotification: Notification) {
// Insert code here to initialize your application
}

func applicationWillTerminate(_ aNotification: Notification) {
// Insert code here to tear down your application
}


func applicationDidFinishLaunching(_ aNotification: Notification) {
// Insert code here to initialize your application
}
func applicationWillTerminate(_ aNotification: Notification) {
// Insert code here to tear down your application
}
}

24 changes: 12 additions & 12 deletions Demo/FNVDemoMacOS/FNVDemoMacOS/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,19 @@ import Cocoa
import FNV

class ViewController: NSViewController {

override func viewDidLoad() {
super.viewDidLoad()

Common.test()
}

override var representedObject: Any? {
didSet {
// Update the view, if already loaded.
override func viewDidLoad() {
super.viewDidLoad()

Common.test()
}
}



override var representedObject: Any? {
didSet {
// Update the view, if already loaded.
}
}


}

6 changes: 3 additions & 3 deletions Demo/FNVDemoMacOS/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
PODS:
- FNV (1.0.13)
- FNV (1.1.0)

DEPENDENCIES:
- FNV (from `../../`)
Expand All @@ -9,8 +9,8 @@ EXTERNAL SOURCES:
:path: "../../"

SPEC CHECKSUMS:
FNV: 00aa7459cbe191147aed292cc943fff1e8ffd6c5
FNV: 49dd72f948fd944b7f9bab85fbcab5fc1df2b671

PODFILE CHECKSUM: de02e565824fb1aaeb86329ba37f56018aebb4f3

COCOAPODS: 1.6.1
COCOAPODS: 1.9.1
15 changes: 6 additions & 9 deletions Demo/FNVDemoTvOS/FNVDemoTvOS.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 50;
objectVersion = 51;
objects = {

/* Begin PBXBuildFile section */
Expand Down Expand Up @@ -120,7 +120,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 1010;
LastUpgradeCheck = 1010;
LastUpgradeCheck = 1200;
ORGANIZATIONNAME = FNVDemoTvOS;
TargetAttributes = {
7EDDC6BA2211348F00C9FAAA = {
Expand Down Expand Up @@ -189,16 +189,11 @@
files = (
);
inputFileListPaths = (
);
inputPaths = (
"${PODS_ROOT}/Target Support Files/Pods-FNVDemoTvOS/Pods-FNVDemoTvOS-frameworks.sh",
"${BUILT_PRODUCTS_DIR}/FNV/FNV.framework",
"${PODS_ROOT}/Target Support Files/Pods-FNVDemoTvOS/Pods-FNVDemoTvOS-frameworks-${CONFIGURATION}-input-files.xcfilelist",
);
name = "[CP] Embed Pods Frameworks";
outputFileListPaths = (
);
outputPaths = (
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FNV.framework",
"${PODS_ROOT}/Target Support Files/Pods-FNVDemoTvOS/Pods-FNVDemoTvOS-frameworks-${CONFIGURATION}-output-files.xcfilelist",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
Expand Down Expand Up @@ -258,6 +253,7 @@
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
Expand Down Expand Up @@ -318,6 +314,7 @@
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
Expand Down
64 changes: 32 additions & 32 deletions Demo/FNVDemoTvOS/FNVDemoTvOS/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,37 +10,37 @@ import UIKit

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

var window: UIWindow?


func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}

func applicationWillResignActive(_ application: UIApplication) {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
}

func applicationDidEnterBackground(_ application: UIApplication) {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}

func applicationWillEnterForeground(_ application: UIApplication) {
// Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
}

func applicationDidBecomeActive(_ application: UIApplication) {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}

func applicationWillTerminate(_ application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}


var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}
func applicationWillResignActive(_ application: UIApplication) {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
}
func applicationDidEnterBackground(_ application: UIApplication) {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
func applicationWillEnterForeground(_ application: UIApplication) {
// Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
}
func applicationDidBecomeActive(_ application: UIApplication) {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
func applicationWillTerminate(_ application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
}

14 changes: 7 additions & 7 deletions Demo/FNVDemoTvOS/FNVDemoTvOS/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ import UIKit
import FNV

class ViewController: UIViewController {

override func viewDidLoad() {
super.viewDidLoad()

Common.test()
}


override func viewDidLoad() {
super.viewDidLoad()

Common.test()
}


}

Loading

0 comments on commit 6adc031

Please sign in to comment.