Skip to content

Commit

Permalink
更新readme
Browse files Browse the repository at this point in the history
  • Loading branch information
intsig171 committed Jun 27, 2024
1 parent 3c822c1 commit 0df3b1d
Show file tree
Hide file tree
Showing 7 changed files with 59 additions and 38 deletions.
28 changes: 28 additions & 0 deletions Document/README/HowToTest.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# SmartCodable Test

The current SmartCodable unit test process looks like this:

The developer's self-test, the demo provides a variety of exhaustive scenarios, will be verified again.
SmartCodable is also used in corporate projects, where business teams test at the functional level.
Each SmartCodable version release will be synchronized to the QQ communication group (group number: 865036731) for online verification.
A major version update of SmartCodable will be released as a beta version for public testing, which can take anywhere from 2 to 4 weeks depending on the size of the feature.



目前SmartCodable的单元测试流程是这样的:

1. 开发人员的自测,demo中提供的穷举的各种场景,都会验证一遍。
2. SmartCodable也用在商业项目中,业务团队会进行功能层面的测试。
3. SmartCodable每次版本发布都会同步到QQ交流群(群号:865036731)做线上验证。
4. SmartCodable的大版本更新,会发布beta版本,进行公测,根据功能大小,公测时间2~4周不等。





### Build test cases that are as complete as possible

构建尽可能完善的测试用例。



Binary file added Document/TestCase.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Document/TestCaseSpecification.xmind
Binary file not shown.
Binary file added Document/testCase2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 14 additions & 13 deletions Example/SmartCodable/Test3ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,26 +21,27 @@ class Test3ViewController: BaseViewController {

let jsonString = """
{
"a": "aa",
"b": 100,
"longitude": "3",
"latitude": 4
"46": "aa",
"47": 100,
}
"""
if let model = SubModel.deserialize(from: jsonString) {
smartPrint(value: model.c)
smartPrint(value: model)
}
}
struct SuperModel: SmartCodable {
var longitude: Double?
var latitude: Double?
}

struct SubModel: SmartCodable {
var a: String?
var b: Int?
var a46: String?
var b47: Int?


static func mappingForKey() -> [SmartKeyTransformer]? {
[
CodingKeys.a46 <--- ["1314520", "5201314"],
CodingKeys.b47 <--- "47",
]
}

@SmartFlat
var c: SuperModel?
}
}

Expand Down
36 changes: 11 additions & 25 deletions Example/SmartCodable/TestViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,35 +18,21 @@ class TestViewController: BaseViewController {
override func viewDidLoad() {
super.viewDidLoad()

let jsonString = """
let jsonStr = """
{
"a": "aa",
"b": 100,
"c": {
"longitude": 300,
"latitude": 400
},
"longitude": 3,
"latitude": 4
"age": "18",
"weight": "65.4",
"sex": "1"
}
"""
if let model = SubClass.deserialize(from: jsonString) {
smartPrint(value: model.c)
if let model = ZJSmartCodableModel.deserialize(from: jsonStr) {
smartPrint(value: model)
}
}
struct SuperClass: SmartCodable {
var longitude: Double?
var latitude: Double?

var a: String?
var b: Int?
}
struct SubClass: SmartCodable {
var a: String?
var b: Int?

@SmartFlat
var c: SuperClass?
//模型
struct ZJSmartCodableModel: SmartCodable {
var age: Int?
var weight: Double?
var sex: Bool?
}
}
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,12 @@ If you don't know how to use it, check it out.



## SmarCodable Test

[👉 To learn more about how SmartCodable is tested, click here]()



## Debug log

**SmartLog Error** indicates that **SmartCodable** encountered a resolution problem and executed compatibility logic. This does not mean that the analysis failed.
Expand Down

0 comments on commit 0df3b1d

Please sign in to comment.