Skip to content

Commit

Permalink
Add Test
Browse files Browse the repository at this point in the history
  • Loading branch information
WindowsMEMZ committed Jan 12, 2024
1 parent a04b192 commit 890572d
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 9 deletions.
2 changes: 1 addition & 1 deletion DarockBili Watch App/DarockBiliApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import SDWebImageSVGCoder
import SDWebImageWebPCoder

//!!!: Debug Setting, Set false Before Release
var debug = false
var debug = true

var debugControlStdout = "stdo\n"

Expand Down
2 changes: 1 addition & 1 deletion DarockBili Watch App/Extension/CodeExt.swift
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ enum BuvidFpError: Error {
struct BuvidFp {
static func gen(key: String, seed: UInt32) throws -> String {
let m = try murmur3_x64_128(key: key, seed: seed)
return String(format: "%016llx%016llx" as NSString, m.low, m.high)
return String(format: "%016llx%016llx", m.low, m.high)
}

private static func murmur3_x64_128(key: String, seed: UInt32) throws -> UInt128 {
Expand Down
39 changes: 32 additions & 7 deletions DarockBili Watch App/Others/AboutView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,13 @@ struct AboutView: View {
Text("开源组件许可")
})
}
//Section {
// NavigationLink(destination: {DebugUITestView()}, label: {
// Text("调试")
// })
//}
if debug {
Section {
NavigationLink(destination: {DebugMenuView()}, label: {
Text("调试")
})
}
}
}
.bold()
}
Expand Down Expand Up @@ -109,14 +111,37 @@ struct AboutView: View {
}
}

struct DebugUITestView: View {
struct DebugMenuView: View {
var body: some View {
List {
NavigationLink(destination: {UserDetailView(uid: "3546572635768935")}, label: {
Text("LongUIDUserTest")
})
NavigationLink(destination: {BuvidFpDebug()}, label: {
Text("buvid_fpTest")
})
}
}
}

struct BuvidFpDebug: View {
@State var fp = ""
@State var resu = ""
var body: some View {
List {
TextField("fp", text: $fp)
Button(action: {
do {
resu = try BuvidFp.gen(key: fp, seed: 31)
} catch {
resu = "Failed: \(error)"
}
}, label: {
Text("Gen")
})
Text(resu)
}
}
}
}

struct AboutView_Previews: PreviewProvider {
Expand Down

0 comments on commit 890572d

Please sign in to comment.