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 Feb 28, 2019
1 parent f890986 commit dd74fbe
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 54 deletions.
35 changes: 35 additions & 0 deletions Demo/Common.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
//
// Common.swift
// FNVDemo
//
// Created by Daisuke T on 2019/02/28.
// Copyright © 2019 FNVDemo. All rights reserved.
//

import Foundation

import FNV

class Common {

static func test() {
print(String(format: "fnv0_32(\"Hello World!\") -> 0x08%x", FNV.fnv0_32("Hello World!")))
print(String(format: "fnv0_64(\"Hello World!\") -> 0x016%lx", FNV.fnv0_64("Hello World!")))
print(String(format: "fnv1_32(\"Hello World!\") -> 0x08%x", FNV.fnv1_32("Hello World!")))
print(String(format: "fnv1_64(\"Hello World!\") -> 0x016%lx", FNV.fnv1_64("Hello World!")))
print(String(format: "fnv1a_32(\"Hello World!\") -> 0x08%x", FNV.fnv1a_32("Hello World!")))
print(String(format: "fnv1a_64(\"Hello World!\") -> 0x016%lx", FNV.fnv1a_64("Hello World!")))


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

print(String(format: "fnv0_32(file) -> 0x08%x", FNV.fnv0_32(data)))
print(String(format: "fnv0_64(file) -> 0x016%lx", FNV.fnv0_64(data)))
print(String(format: "fnv1_32(file) -> 0x08%x", FNV.fnv1_32(data)))
print(String(format: "fnv1_64(file) -> 0x016%lx", FNV.fnv1_64(data)))
print(String(format: "fnv1a_32(file) -> 0x08%x", FNV.fnv1a_32(data)))
print(String(format: "fnv1a_64(file) -> 0x016%lx", FNV.fnv1a_64(data)))
}
}
4 changes: 4 additions & 0 deletions Demo/FNVDemoMacOS/FNVDemoMacOS.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
021493A72209128700B7DBF2 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 021493A62209128700B7DBF2 /* ViewController.swift */; };
021493A92209128A00B7DBF2 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 021493A82209128A00B7DBF2 /* Assets.xcassets */; };
021493AC2209128A00B7DBF2 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 021493AA2209128A00B7DBF2 /* Main.storyboard */; };
02AB4F692227CB8F00BDC373 /* Common.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02AB4F682227CB8F00BDC373 /* Common.swift */; };
02CBB3E7221A9ED4000BCF7E /* alice29.txt in Resources */ = {isa = PBXBuildFile; fileRef = 02CBB3E6221A9ED4000BCF7E /* alice29.txt */; };
CDBBF95A78E1D64C91BD6016 /* Pods_FNVDemoMacOS.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7481E87AFBBB7F6E4489BE93 /* Pods_FNVDemoMacOS.framework */; };
/* End PBXBuildFile section */
Expand All @@ -23,6 +24,7 @@
021493AB2209128A00B7DBF2 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
021493AD2209128A00B7DBF2 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
021493AE2209128A00B7DBF2 /* FNVDemoMacOS.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = FNVDemoMacOS.entitlements; sourceTree = "<group>"; };
02AB4F682227CB8F00BDC373 /* Common.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = Common.swift; path = ../../Common.swift; sourceTree = "<group>"; };
02CBB3E6221A9ED4000BCF7E /* alice29.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = alice29.txt; sourceTree = "<group>"; };
1237BC4D66017B8E73FDA08C /* Pods-FNVDemoMacOS.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-FNVDemoMacOS.release.xcconfig"; path = "Target Support Files/Pods-FNVDemoMacOS/Pods-FNVDemoMacOS.release.xcconfig"; sourceTree = "<group>"; };
7481E87AFBBB7F6E4489BE93 /* Pods_FNVDemoMacOS.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_FNVDemoMacOS.framework; sourceTree = BUILT_PRODUCTS_DIR; };
Expand Down Expand Up @@ -62,6 +64,7 @@
021493A32209128700B7DBF2 /* FNVDemoMacOS */ = {
isa = PBXGroup;
children = (
02AB4F682227CB8F00BDC373 /* Common.swift */,
021493A42209128700B7DBF2 /* AppDelegate.swift */,
021493A62209128700B7DBF2 /* ViewController.swift */,
021493A82209128A00B7DBF2 /* Assets.xcassets */,
Expand Down Expand Up @@ -211,6 +214,7 @@
buildActionMask = 2147483647;
files = (
021493A72209128700B7DBF2 /* ViewController.swift in Sources */,
02AB4F692227CB8F00BDC373 /* Common.swift in Sources */,
021493A52209128700B7DBF2 /* AppDelegate.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down
19 changes: 1 addition & 18 deletions Demo/FNVDemoMacOS/FNVDemoMacOS/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,7 @@ class ViewController: NSViewController {
override func viewDidLoad() {
super.viewDidLoad()

print(String(format: "fnv0_32(\"Hello World!\") -> 0x02%x", FNV.fnv0_32("Hello World!")))
print(String(format: "fnv0_64(\"Hello World!\") -> 0x02%lx", FNV.fnv0_64("Hello World!")))
print(String(format: "fnv1_32(\"Hello World!\") -> 0x02%x", FNV.fnv1_32("Hello World!")))
print(String(format: "fnv1_64(\"Hello World!\") -> 0x02%lx", FNV.fnv1_64("Hello World!")))
print(String(format: "fnv1a_32(\"Hello World!\") -> 0x02%x", FNV.fnv1a_32("Hello World!")))
print(String(format: "fnv1a_64(\"Hello World!\") -> 0x02%lx", FNV.fnv1a_64("Hello World!")))


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

print(String(format: "fnv0_32(file) -> 0x02%x", FNV.fnv0_32(data)))
print(String(format: "fnv0_64(file) -> 0x02%lx", FNV.fnv0_64(data)))
print(String(format: "fnv1_32(file) -> 0x02%x", FNV.fnv1_32(data)))
print(String(format: "fnv1_64(file) -> 0x02%lx", FNV.fnv1_64(data)))
print(String(format: "fnv1a_32(file) -> 0x02%x", FNV.fnv1a_32(data)))
print(String(format: "fnv1a_64(file) -> 0x02%lx", FNV.fnv1a_64(data)))
Common.test()
}

override var representedObject: Any? {
Expand Down
4 changes: 4 additions & 0 deletions Demo/FNVDemoTvOS/FNVDemoTvOS.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
objects = {

/* Begin PBXBuildFile section */
02AB4F6D2227CCF000BDC373 /* Common.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02AB4F6C2227CCF000BDC373 /* Common.swift */; };
02CBB3EB221AA27A000BCF7E /* alice29.txt in Resources */ = {isa = PBXBuildFile; fileRef = 02CBB3EA221AA27A000BCF7E /* alice29.txt */; };
7EDDC6BF2211348F00C9FAAA /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7EDDC6BE2211348F00C9FAAA /* AppDelegate.swift */; };
7EDDC6C12211348F00C9FAAA /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7EDDC6C02211348F00C9FAAA /* ViewController.swift */; };
Expand All @@ -16,6 +17,7 @@
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
02AB4F6C2227CCF000BDC373 /* Common.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Common.swift; path = ../../Common.swift; sourceTree = "<group>"; };
02CBB3EA221AA27A000BCF7E /* alice29.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = alice29.txt; sourceTree = "<group>"; };
285BF74D74538BC33663396C /* Pods-FNVDemoTvOS.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-FNVDemoTvOS.debug.xcconfig"; path = "Target Support Files/Pods-FNVDemoTvOS/Pods-FNVDemoTvOS.debug.xcconfig"; sourceTree = "<group>"; };
7EDDC6BB2211348F00C9FAAA /* FNVDemoTvOS.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = FNVDemoTvOS.app; sourceTree = BUILT_PRODUCTS_DIR; };
Expand Down Expand Up @@ -69,6 +71,7 @@
7EDDC6BD2211348F00C9FAAA /* FNVDemoTvOS */ = {
isa = PBXGroup;
children = (
02AB4F6C2227CCF000BDC373 /* Common.swift */,
7EDDC6BE2211348F00C9FAAA /* AppDelegate.swift */,
7EDDC6C02211348F00C9FAAA /* ViewController.swift */,
7EDDC6C22211348F00C9FAAA /* Main.storyboard */,
Expand Down Expand Up @@ -209,6 +212,7 @@
buildActionMask = 2147483647;
files = (
7EDDC6C12211348F00C9FAAA /* ViewController.swift in Sources */,
02AB4F6D2227CCF000BDC373 /* Common.swift in Sources */,
7EDDC6BF2211348F00C9FAAA /* AppDelegate.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down
19 changes: 1 addition & 18 deletions Demo/FNVDemoTvOS/FNVDemoTvOS/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,7 @@ class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()

print(String(format: "fnv0_32(\"Hello World!\") -> 0x02%x", FNV.fnv0_32("Hello World!")))
print(String(format: "fnv0_64(\"Hello World!\") -> 0x02%lx", FNV.fnv0_64("Hello World!")))
print(String(format: "fnv1_32(\"Hello World!\") -> 0x02%x", FNV.fnv1_32("Hello World!")))
print(String(format: "fnv1_64(\"Hello World!\") -> 0x02%lx", FNV.fnv1_64("Hello World!")))
print(String(format: "fnv1a_32(\"Hello World!\") -> 0x02%x", FNV.fnv1a_32("Hello World!")))
print(String(format: "fnv1a_64(\"Hello World!\") -> 0x02%lx", FNV.fnv1a_64("Hello World!")))


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

print(String(format: "fnv0_32(file) -> 0x02%x", FNV.fnv0_32(data)))
print(String(format: "fnv0_64(file) -> 0x02%lx", FNV.fnv0_64(data)))
print(String(format: "fnv1_32(file) -> 0x02%x", FNV.fnv1_32(data)))
print(String(format: "fnv1_64(file) -> 0x02%lx", FNV.fnv1_64(data)))
print(String(format: "fnv1a_32(file) -> 0x02%x", FNV.fnv1a_32(data)))
print(String(format: "fnv1a_64(file) -> 0x02%lx", FNV.fnv1a_64(data)))
Common.test()
}


Expand Down
4 changes: 4 additions & 0 deletions Demo/FNVDemoiOS/FNVDemoiOS.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
021D66B62208283200D88FC1 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 021D66B42208283200D88FC1 /* Main.storyboard */; };
021D66B82208283400D88FC1 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 021D66B72208283400D88FC1 /* Assets.xcassets */; };
021D66BB2208283400D88FC1 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 021D66B92208283400D88FC1 /* LaunchScreen.storyboard */; };
02AB4F6B2227CC7C00BDC373 /* Common.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02AB4F6A2227CC7C00BDC373 /* Common.swift */; };
02CBB3E9221AA143000BCF7E /* alice29.txt in Resources */ = {isa = PBXBuildFile; fileRef = 02CBB3E8221AA143000BCF7E /* alice29.txt */; };
A8A0876ADCF57BF312DF1066 /* Pods_FNVDemoiOS.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9923736533B7BCD12C08D1CC /* Pods_FNVDemoiOS.framework */; };
/* End PBXBuildFile section */
Expand All @@ -24,6 +25,7 @@
021D66B72208283400D88FC1 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
021D66BA2208283400D88FC1 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
021D66BC2208283400D88FC1 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
02AB4F6A2227CC7C00BDC373 /* Common.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Common.swift; path = ../../Common.swift; sourceTree = "<group>"; };
02CBB3E8221AA143000BCF7E /* alice29.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = alice29.txt; sourceTree = "<group>"; };
6A5753724AB62E311C1A4D3C /* Pods-FNVDemoiOS.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-FNVDemoiOS.release.xcconfig"; path = "Pods/Target Support Files/Pods-FNVDemoiOS/Pods-FNVDemoiOS.release.xcconfig"; sourceTree = "<group>"; };
9923736533B7BCD12C08D1CC /* Pods_FNVDemoiOS.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_FNVDemoiOS.framework; sourceTree = BUILT_PRODUCTS_DIR; };
Expand Down Expand Up @@ -63,6 +65,7 @@
021D66AF2208283200D88FC1 /* FNVDemoiOS */ = {
isa = PBXGroup;
children = (
02AB4F6A2227CC7C00BDC373 /* Common.swift */,
021D66B02208283200D88FC1 /* AppDelegate.swift */,
021D66B22208283200D88FC1 /* ViewController.swift */,
021D66B42208283200D88FC1 /* Main.storyboard */,
Expand Down Expand Up @@ -213,6 +216,7 @@
buildActionMask = 2147483647;
files = (
021D66B32208283200D88FC1 /* ViewController.swift in Sources */,
02AB4F6B2227CC7C00BDC373 /* Common.swift in Sources */,
021D66B12208283200D88FC1 /* AppDelegate.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down
19 changes: 1 addition & 18 deletions Demo/FNVDemoiOS/FNVDemoiOS/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,7 @@ class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()

print(String(format: "fnv0_32(\"Hello World!\") -> 0x02%x", FNV.fnv0_32("Hello World!")))
print(String(format: "fnv0_64(\"Hello World!\") -> 0x02%lx", FNV.fnv0_64("Hello World!")))
print(String(format: "fnv1_32(\"Hello World!\") -> 0x02%x", FNV.fnv1_32("Hello World!")))
print(String(format: "fnv1_64(\"Hello World!\") -> 0x02%lx", FNV.fnv1_64("Hello World!")))
print(String(format: "fnv1a_32(\"Hello World!\") -> 0x02%x", FNV.fnv1a_32("Hello World!")))
print(String(format: "fnv1a_64(\"Hello World!\") -> 0x02%lx", FNV.fnv1a_64("Hello World!")))


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

print(String(format: "fnv0_32(file) -> 0x02%x", FNV.fnv0_32(data)))
print(String(format: "fnv0_64(file) -> 0x02%lx", FNV.fnv0_64(data)))
print(String(format: "fnv1_32(file) -> 0x02%x", FNV.fnv1_32(data)))
print(String(format: "fnv1_64(file) -> 0x02%lx", FNV.fnv1_64(data)))
print(String(format: "fnv1a_32(file) -> 0x02%x", FNV.fnv1a_32(data)))
print(String(format: "fnv1a_64(file) -> 0x02%lx", FNV.fnv1a_64(data)))
Common.test()
}


Expand Down

0 comments on commit dd74fbe

Please sign in to comment.