Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
Elixxir dApps SDK Swift
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mobile
iOS
Elixxir dApps SDK Swift
Commits
d98e0fa0
Commit
d98e0fa0
authored
2 years ago
by
Dariusz Rybicki
Browse files
Options
Downloads
Patches
Plain Diff
Add GroupReport model
parent
d83acfea
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!102
Release 1.0.0
,
!24
Update Bindings
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Sources/ElixxirDAppsSDK/Models/GroupReport.swift
+33
-0
33 additions, 0 deletions
Sources/ElixxirDAppsSDK/Models/GroupReport.swift
Tests/ElixxirDAppsSDKTests/Models/GroupReportTests.swift
+31
-0
31 additions, 0 deletions
Tests/ElixxirDAppsSDKTests/Models/GroupReportTests.swift
with
64 additions
and
0 deletions
Sources/ElixxirDAppsSDK/Models/GroupReport.swift
0 → 100644
+
33
−
0
View file @
d98e0fa0
import
Foundation
public
struct
GroupReport
:
Equatable
{
public
init
(
id
:
Data
,
rounds
:
[
Int
],
status
:
Int
)
{
self
.
id
=
id
self
.
rounds
=
rounds
self
.
status
=
status
}
public
var
id
:
Data
public
var
rounds
:
[
Int
]
public
var
status
:
Int
}
extension
GroupReport
:
Codable
{
enum
CodingKeys
:
String
,
CodingKey
{
case
id
=
"Id"
case
rounds
=
"Rounds"
case
status
=
"Status"
}
public
static
func
decode
(
_
data
:
Data
)
throws
->
Self
{
try
JSONDecoder
()
.
decode
(
Self
.
self
,
from
:
data
)
}
public
func
encode
()
throws
->
Data
{
try
JSONEncoder
()
.
encode
(
self
)
}
}
This diff is collapsed.
Click to expand it.
Tests/ElixxirDAppsSDKTests/Models/GroupReportTests.swift
0 → 100644
+
31
−
0
View file @
d98e0fa0
import
CustomDump
import
XCTest
@testable
import
ElixxirDAppsSDK
final
class
GroupReportTests
:
XCTestCase
{
func
testCoding
()
throws
{
let
idB64
=
"EB/70R5HYEw5htZ4Hg9ondrn3+cAc/lH2G0mjQMja3w="
let
rounds
:
[
Int
]
=
[
1
,
5
,
9
]
let
status
:
Int
=
123
let
jsonString
=
"""
{
"
Id
": "
\(
idB64
)
",
"
Rounds
": [
\(
rounds
.
map
{
"
\(
$0
)
"
}
.
joined
(
separator
:
", "
)
)
],
"
Status
":
\(
status
)
}
"""
let
jsonData
=
jsonString
.
data
(
using
:
.
utf8
)
!
let
model
=
try
GroupReport
.
decode
(
jsonData
)
XCTAssertNoDifference
(
model
,
GroupReport
(
id
:
Data
(
base64Encoded
:
idB64
)
!
,
rounds
:
rounds
,
status
:
status
))
let
encodedModel
=
try
model
.
encode
()
let
decodedModel
=
try
GroupReport
.
decode
(
encodedModel
)
XCTAssertNoDifference
(
decodedModel
,
model
)
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment