From 15f012a65aa6ec0d573fa0a04643d11b679b8390 Mon Sep 17 00:00:00 2001 From: Tom Hicks Date: Sat, 26 Sep 2020 23:10:24 -0700 Subject: [PATCH] Fixes JSON initializer and tests. --- MonsterCards/Models/Monster.m | 12 ++++++------ MonsterCardsTests/Models/MonsterTests.m | 24 ++++++++++++------------ 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/MonsterCards/Models/Monster.m b/MonsterCards/Models/Monster.m index 22e0d5d..25ee106 100644 --- a/MonsterCards/Models/Monster.m +++ b/MonsterCards/Models/Monster.m @@ -114,12 +114,12 @@ NSString* const kMonsterSizeGargantuan = @"gargantuan"; self.alignment = [JSONHelper readStringFromDictionary:jsonRoot forKey:@"alignment" withDefaultValue:@""]; self.armorType = [JSONHelper readStringFromDictionary:jsonRoot forKey:@"armorName" withDefaultValue:@""]; self.otherArmorDescription = [JSONHelper readStringFromDictionary:jsonRoot forKey:@"otherArmorDesc" withDefaultValue:@""]; - self.strengthScore = [JSONHelper readIntFromDictionary:jsonRoot forKey:@"strPoints" withDefaultValue:0]; - self.dexterityScore = [JSONHelper readIntFromDictionary:jsonRoot forKey:@"dexPoints" withDefaultValue:0]; - self.constitutionScore = [JSONHelper readIntFromDictionary:jsonRoot forKey:@"conPoints" withDefaultValue:0]; - self.intelligenceScore = [JSONHelper readIntFromDictionary:jsonRoot forKey:@"intPoints" withDefaultValue:0]; - self.wisdomScore = [JSONHelper readIntFromDictionary:jsonRoot forKey:@"wisPoints" withDefaultValue:0]; - self.charismaScore = [JSONHelper readIntFromDictionary:jsonRoot forKey:@"chaPoints" withDefaultValue:0]; + self.strengthScore = [JSONHelper readIntFromDictionary:jsonRoot forKey:@"strPoints" withDefaultValue:10]; + self.dexterityScore = [JSONHelper readIntFromDictionary:jsonRoot forKey:@"dexPoints" withDefaultValue:10]; + self.constitutionScore = [JSONHelper readIntFromDictionary:jsonRoot forKey:@"conPoints" withDefaultValue:10]; + self.intelligenceScore = [JSONHelper readIntFromDictionary:jsonRoot forKey:@"intPoints" withDefaultValue:10]; + self.wisdomScore = [JSONHelper readIntFromDictionary:jsonRoot forKey:@"wisPoints" withDefaultValue:10]; + self.charismaScore = [JSONHelper readIntFromDictionary:jsonRoot forKey:@"chaPoints" withDefaultValue:10]; self.shieldBonus = [JSONHelper readIntFromDictionary:jsonRoot forKey:@"shieldBonus" withDefaultValue:0]; self.hitDice = [JSONHelper readIntFromDictionary:jsonRoot forKey:@"hitDice" withDefaultValue:0]; diff --git a/MonsterCardsTests/Models/MonsterTests.m b/MonsterCardsTests/Models/MonsterTests.m index e999514..5720237 100644 --- a/MonsterCardsTests/Models/MonsterTests.m +++ b/MonsterCardsTests/Models/MonsterTests.m @@ -40,12 +40,12 @@ XCTAssertEqualObjects(@"", _monster.type); XCTAssertEqualObjects(@"", _monster.subtype); XCTAssertEqualObjects(@"", _monster.alignment); - XCTAssertEqual(0, _monster.strengthScore); - XCTAssertEqual(0, _monster.dexterityScore); - XCTAssertEqual(0, _monster.constitutionScore); - XCTAssertEqual(0, _monster.intelligenceScore); - XCTAssertEqual(0, _monster.wisdomScore); - XCTAssertEqual(0, _monster.charismaScore); + XCTAssertEqual(10, _monster.strengthScore); + XCTAssertEqual(10, _monster.dexterityScore); + XCTAssertEqual(10, _monster.constitutionScore); + XCTAssertEqual(10, _monster.intelligenceScore); + XCTAssertEqual(10, _monster.wisdomScore); + XCTAssertEqual(10, _monster.charismaScore); XCTAssertEqualObjects(@"", _monster.armorType); XCTAssertEqualObjects(@"", _monster.otherArmorDescription); XCTAssertEqual(0, _monster.shieldBonus); @@ -85,12 +85,12 @@ XCTAssertEqualObjects(@"", _monster.type); XCTAssertEqualObjects(@"", _monster.subtype); XCTAssertEqualObjects(@"", _monster.alignment); - XCTAssertEqual(0, _monster.strengthScore); - XCTAssertEqual(0, _monster.dexterityScore); - XCTAssertEqual(0, _monster.constitutionScore); - XCTAssertEqual(0, _monster.intelligenceScore); - XCTAssertEqual(0, _monster.wisdomScore); - XCTAssertEqual(0, _monster.charismaScore); + XCTAssertEqual(10, _monster.strengthScore); + XCTAssertEqual(10, _monster.dexterityScore); + XCTAssertEqual(10, _monster.constitutionScore); + XCTAssertEqual(10, _monster.intelligenceScore); + XCTAssertEqual(10, _monster.wisdomScore); + XCTAssertEqual(10, _monster.charismaScore); XCTAssertEqualObjects(@"", _monster.armorType); XCTAssertEqualObjects(@"", _monster.otherArmorDescription); XCTAssertEqual(0, _monster.shieldBonus);