using System.IO.Compression;\r
using System.Linq;\r
using ExpressionToCodeLib;\r
+using KancolleSniffer.Model;\r
+using KancolleSniffer.Util;\r
using Microsoft.VisualStudio.TestTools.UnitTesting;\r
+using static System.Math;\r
\r
namespace KancolleSniffer.Test\r
{\r
+ using Sniffer = SnifferTest.TestingSniffer;\r
+\r
[TestClass]\r
public class SnifferTest\r
{\r
+ [ClassInitialize]\r
+ public static void Initialize(TestContext context)\r
+ {\r
+ ExpressionToCodeConfiguration.GlobalAssertionConfiguration = ExpressionToCodeConfiguration\r
+ .GlobalAssertionConfiguration.WithPrintedListLengthLimit(200).WithMaximumValueLength(1000);\r
+ }\r
+\r
+ public class TestingSniffer : KancolleSniffer.Sniffer\r
+ {\r
+ public TestingSniffer(bool start = false) : base(start)\r
+ {\r
+ AdditionalData.UseNumEquipsFile = false;\r
+ }\r
+ }\r
+\r
public static StreamReader OpenLogFile(string name)\r
{\r
var dir = Path.GetDirectoryName(Path.GetDirectoryName(Environment.CurrentDirectory));\r
}\r
\r
/// <summary>\r
- /// 4-2-1で開幕対潜雷撃を含む戦闘を行う\r
- /// </summary>\r
- [TestMethod]\r
- public void NormalBattleWithVriousTypesOfAttack()\r
- {\r
- var sniffer = new Sniffer();\r
- SniffLogFile(sniffer, "battle_001");\r
- PAssert.That(() => sniffer.Battle.ResultRank == BattleResultRank.A);\r
- AssertEqualBattleResult(sniffer,\r
- new[] {57, 66, 50, 65, 40, 42}, new[] {34, 5, 0, 0, 0, 0});\r
- }\r
-\r
- private void AssertEqualBattleResult(Sniffer sniffer, IEnumerable<int> expected, IEnumerable<int> enemy,\r
- string msg = null)\r
- {\r
- var result = sniffer.GetShipStatuses(0).Select(s => s.NowHp);\r
- PAssert.That(() => expected.SequenceEqual(result), msg);\r
- var enemyResult = sniffer.Battle.EnemyResultStatus.Select(s => s.NowHp);\r
- PAssert.That(() => enemy.SequenceEqual(enemyResult), msg);\r
- }\r
-\r
- /// <summary>\r
- /// 開幕夜戦で潜水艦同士がお見合いする\r
- /// </summary>\r
- [TestMethod]\r
- public void SpMidnightWithoutBattle()\r
- {\r
- var sniffer = new Sniffer();\r
- SniffLogFile(sniffer, "sp_midnight_001");\r
- PAssert.That(() => sniffer.Battle.ResultRank == BattleResultRank.D);\r
- }\r
-\r
- /// <summary>\r
- /// 夜戦で戦艦が攻撃すると一回で三発分のデータが来る\r
- /// そのうち存在しない攻撃はターゲット、ダメージともに-1になる\r
- /// </summary>\r
- [TestMethod]\r
- public void BattleShipAttackInMidnight()\r
- {\r
- var sniffer = new Sniffer();\r
- SniffLogFile(sniffer, "midnight_001");\r
- PAssert.That(() => sniffer.Battle.ResultRank == BattleResultRank.S);\r
- }\r
-\r
- /// <summary>\r
- /// 7隻編成の戦闘で7隻目が攻撃される\r
- /// </summary>\r
- [TestMethod]\r
- public void Ship7Battle()\r
- {\r
- var sniffer = new Sniffer();\r
- SniffLogFile(sniffer, "ship7battle_001");\r
- PAssert.That(() => sniffer.Battle.ResultRank == BattleResultRank.P);\r
- }\r
-\r
- /// <summary>\r
- /// 演習のあとのportで戦闘結果の検証を行わない\r
- /// </summary>\r
- [TestMethod]\r
- public void NotVerifyBattleResultAfterPractice()\r
- {\r
- var sniffer = new Sniffer();\r
- SniffLogFile(sniffer, "practice_001");\r
- PAssert.That(() => !sniffer.IsBattleResultStatusError);\r
- }\r
-\r
- /// <summary>\r
- /// 連合艦隊が開幕雷撃で被弾する\r
- /// </summary>\r
- [TestMethod]\r
- public void OpeningTorpedoInCombinedBattle()\r
- {\r
- var sniffer = new Sniffer();\r
- SniffLogFile(sniffer, "combined_battle_001");\r
- PAssert.That(() => !sniffer.IsBattleResultStatusError);\r
- }\r
-\r
- /// <summary>\r
- /// 連合艦隊が閉幕雷撃で被弾する\r
- /// </summary>\r
- [TestMethod]\r
- public void ClosingTorpedoInCombinedBattle()\r
- {\r
- var sniffer = new Sniffer();\r
- SniffLogFile(sniffer, "combined_battle_002");\r
- PAssert.That(() => !sniffer.IsBattleResultStatusError);\r
- }\r
-\r
- /// <summary>\r
- /// 第一が6隻未満の連合艦隊で戦闘する\r
+ /// 熟練度込みの制空値を正しく計算する\r
/// </summary>\r
[TestMethod]\r
- public void SmallCombinedFleetBattle()\r
+ public void FighterPowerWithBonus()\r
{\r
var sniffer = new Sniffer();\r
- SniffLogFile(sniffer, "combined_battle_003");\r
- PAssert.That(() => !sniffer.IsBattleResultStatusError);\r
+ SniffLogFile(sniffer, "fighterpower_001");\r
+ var fleet = sniffer.Fleets[0];\r
+ PAssert.That(() => fleet.FighterPower.SequenceEqual(new[] {156, 159}));\r
+ SniffLogFile(sniffer, "fighterpower_002");\r
+ PAssert.That(() => fleet.FighterPower.SequenceEqual(new[] {140, 143}), "全滅したスロットがある");\r
}\r
\r
/// <summary>\r
- /// 護衛退避する\r
+ /// 改修効果込みの制空値を正しく計算する\r
/// </summary>\r
[TestMethod]\r
- public void EscapeWithEscort()\r
+ public void FighterPowerWithImprovement()\r
{\r
var sniffer = new Sniffer();\r
- SniffLogFile(sniffer, "escape_001");\r
- PAssert.That(() => sniffer.GetShipStatuses(0)[5].Escaped &&\r
- sniffer.GetShipStatuses(1)[2].Escaped);\r
+ SniffLogFile(sniffer, "fighterpower_003");\r
+ PAssert.That(() => sniffer.Fleets[0].FighterPower.SequenceEqual(new[] {135, 135}));\r
}\r
\r
/// <summary>\r
- /// 開幕夜戦に支援が来る\r
+ /// 基地航空隊の制空値を正しく計算する\r
/// </summary>\r
[TestMethod]\r
- public void SpMidnightSupportAttack()\r
+ public void FighterPowerOfBaseAirCorps()\r
{\r
var sniffer = new Sniffer();\r
- SniffLogFile(sniffer, "sp_midnight_002");\r
- PAssert.That(() => !sniffer.Battle.DisplayedResultRank.IsError);\r
+ SniffLogFile(sniffer, "baseaircorps_001");\r
+ PAssert.That(() => sniffer.BaseAirCorps[0].AirCorps[0].FighterPower.AirCombat[1] == 301);\r
+ sniffer.BaseAirCorps[0].AirCorps[0].Action = 2; // 防空\r
+ PAssert.That(() => sniffer.BaseAirCorps[0].AirCorps[0].FighterPower.Interception[1] == 320);\r
}\r
\r
/// <summary>\r
- /// 払暁戦を行う\r
+ /// 基地航空隊の防空時の偵察機補正を含む制空値を計算する\r
/// </summary>\r
[TestMethod]\r
- public void NightToDay()\r
+ public void FighterPowerWithReconBonus()\r
{\r
var sniffer = new Sniffer();\r
- SniffLogFile(sniffer, "nighttoday_001");\r
- PAssert.That(() => !sniffer.Battle.DisplayedResultRank.IsError && !sniffer.IsBattleResultStatusError);\r
+ SniffLogFile(sniffer, "baseaircorps_002");\r
+ PAssert.That(() => sniffer.BaseAirCorps[0].AirCorps[2].FighterPower.Interception[0] == 353);\r
}\r
\r
/// <summary>\r
- /// 単艦退避する\r
+ /// 陸上攻撃機の熟練度を制空値に反映させる\r
/// </summary>\r
[TestMethod]\r
- public void EscapeWithoutEscort()\r
+ public void FighterPowerOfLandBasedAttackAircraft()\r
{\r
var sniffer = new Sniffer();\r
- SniffLogFile(sniffer, "escape_002");\r
- PAssert.That(() => sniffer.GetShipStatuses(2)[1].Escaped);\r
- PAssert.That(() => !sniffer.IsBattleResultStatusError);\r
+ SniffLogFile(sniffer, "baseaircorps_003");\r
+ PAssert.That(() => sniffer.BaseAirCorps[1].AirCorps[0].FighterPower.AirCombat[0] == 121);\r
}\r
\r
/// <summary>\r
- /// å\87ºæ\92\83æ\99\82ã\81«å¤§ç ´ã\81\97ã\81¦ã\81\84ã\82\8bè\89¦å¨\98ã\81\8cã\81\84ã\81\9fã\82\89è¦å\91\8aする\r
+ /// å\9fºå\9c°è\88ªç©ºé\9a\8aã\81®å\87ºæ\92\83ã\82³ã\82¹ã\83\88ã\82\92è¨\88ç®\97する\r
/// </summary>\r
[TestMethod]\r
- public void DamagedShipWarningOnMapStart()\r
+ public void CostForSortieOfBaseAirCorps()\r
{\r
var sniffer = new Sniffer();\r
- SniffLogFile(sniffer, "mapstart_001");\r
- PAssert.That(() => sniffer.BadlyDamagedShips.SequenceEqual(new[] {"大潮"}));\r
+ SniffLogFile(sniffer, "baseaircorps_003");\r
+ PAssert.That(() => sniffer.BaseAirCorps[1].AirCorps[0].CostForSortie.SequenceEqual(new[] {99, 47}));\r
}\r
\r
/// <summary>\r
- /// é\80£å\90\88è\89¦é\9a\8aã\81«å¤§ç ´è\89¦ã\81\8cã\81\84ã\82\8bç\8a¶æ\85\8bã\81§ç¬¬3è\89¦é\9a\8aã\81\8cå\87ºæ\92\83ã\81\97ã\81\9fã\81¨ã\81\8dã\81«è¦å\91\8aã\81\97ã\81ªã\81\84\r
+ /// é\99¸ä¸\8aæ\88¦é\97\98æ©\9fã\81®æ\94¹ä¿®ã\83¬ã\83\99ã\83«ã\82\92å\88¶ç©ºå\80¤ã\81«å\8f\8dæ\98 ã\81\95ã\81\9bã\82\8bã\80\82\r
/// </summary>\r
[TestMethod]\r
- public void NotWarnDamagedShipInCombinedFleetOnMapStart()\r
+ public void FighterPowerOfLandBAseFighter()\r
{\r
var sniffer = new Sniffer();\r
- SniffLogFile(sniffer, "mapstart_002");\r
- PAssert.That(() => !sniffer.BadlyDamagedShips.Any());\r
+ SniffLogFile(sniffer, "baseaircorps_004");\r
+ PAssert.That(() => sniffer.BaseAirCorps[1].AirCorps[0].FighterPower.AirCombat[0] == 328);\r
}\r
\r
/// <summary>\r
- /// 熟練度込みの制空値を正しく計算する\r
+ /// マップ索敵の判定式(33)を正しく計算する\r
/// </summary>\r
[TestMethod]\r
- public void FighterPowerWithBonus()\r
+ public void LineOfSight()\r
{\r
var sniffer = new Sniffer();\r
- SniffLogFile(sniffer, "fighterpower_001");\r
- PAssert.That(() => sniffer.GetFighterPower(0).SequenceEqual(new[] {156, 159}));\r
- SniffLogFile(sniffer, "fighterpower_002");\r
- PAssert.That(() => sniffer.GetFighterPower(0).SequenceEqual(new[] {140, 143}), "全滅したスロットがある");\r
+ SniffLogFile(sniffer, "lineofsight_001");\r
+ var fleet = sniffer.Fleets[0];\r
+ PAssert.That(() => Abs(fleet.GetLineOfSights(1) - 39.45) < 0.01);\r
+ PAssert.That(() => Abs(fleet.GetLineOfSights(3) - 115.19) < 0.01);\r
+ PAssert.That(() => Abs(fleet.GetLineOfSights(4) - 153.06) < 0.01);\r
+ SniffLogFile(sniffer, "lineofsight_002");\r
+ PAssert.That(() => Abs(fleet.GetLineOfSights(1) - -25.10) < 0.01, "艦隊に空きがある");\r
}\r
\r
/// <summary>\r
- /// 改修効果込みの制空値を正しく計算する\r
+ /// 触接開始率を正しく計算する\r
/// </summary>\r
[TestMethod]\r
- public void FighterPowerWithImprovement()\r
+ public void ContactTriggerRage()\r
{\r
var sniffer = new Sniffer();\r
- SniffLogFile(sniffer, "fighterpower_003");\r
- PAssert.That(() => sniffer.GetFighterPower(0).SequenceEqual(new[] {135, 135}));\r
+ SniffLogFile(sniffer, "contact_001");\r
+ PAssert.That(() => Abs(sniffer.Fleets[0].ContactTriggerRate - 1.8182) < 0.0001);\r
}\r
\r
/// <summary>\r
- /// 基地航空隊の制空値を正しく計算する\r
+ /// TPを計算する\r
/// </summary>\r
[TestMethod]\r
- public void FighterPowerOfBaseAirCorps()\r
+ public void TransportPoint()\r
{\r
var sniffer = new Sniffer();\r
- SniffLogFile(sniffer, "baseaircorps_001");\r
- PAssert.That(() => sniffer.BaseAirCorps[0].AirCorps[0].FighterPower[1] == 301);\r
- sniffer.BaseAirCorps[0].AirCorps[0].Action = 2; // 防空\r
- PAssert.That(() => sniffer.BaseAirCorps[0].AirCorps[0].FighterPower[1] == 320);\r
+ var msgs = new[] {"", "鬼怒改二+特大発+おにぎり", "駆逐艦+士魂部隊", "補給艦"};\r
+ var results = new[] {47, 19, 13, 15};\r
+ for (var i = 0; i < msgs.Length; i++)\r
+ {\r
+ SniffLogFile(sniffer, "transportpoint_00" + (i + 1));\r
+ var j = i;\r
+ PAssert.That(() => (int)sniffer.Fleets[0].TransportPoint == results[j], msgs[j]);\r
+ }\r
}\r
\r
/// <summary>\r
- /// å\9fºå\9c°è\88ªç©ºé\9a\8aã\81®é\98²ç©ºæ\99\82ã\81®å\81µå¯\9fæ©\9fè£\9cæ£ã\82\92å\90«ã\82\80å\88¶ç©ºå\80¤を計算する\r
+ /// å¯¾ç©ºç ²ç\81«ã\81®ã\83\91ã\83©ã\83¡ã\83¼ã\82¿を計算する\r
/// </summary>\r
[TestMethod]\r
- public void FighterPowerWithReconBonus()\r
+ public void AntiAirFire()\r
{\r
var sniffer = new Sniffer();\r
- SniffLogFile(sniffer, "baseaircorps_002");\r
- PAssert.That(() => sniffer.BaseAirCorps[0].AirCorps[2].FighterPower[0] == 353);\r
+ SniffLogFile(sniffer, "antiairfire_001");\r
+ var ships = sniffer.Fleets[0].Ships;\r
+ PAssert.That(() => ships.Sum(ship => ship.EffectiveAntiAirForFleet) == 88);\r
+ PAssert.That(\r
+ () =>\r
+ ships.Select(ship => ship.EffectiveAntiAirForShip)\r
+ .SequenceEqual(new[] {92, 90, 88, 228, 146, 226}));\r
}\r
\r
/// <summary>\r
- /// 陸上攻撃機の熟練度を制空値に反映させる\r
+ /// 空母の夜戦火力を計算する\r
/// </summary>\r
[TestMethod]\r
- public void FighterPowerOfLandBasedAttackAircraft()\r
+ public void CvNightBattlePower()\r
{\r
var sniffer = new Sniffer();\r
- SniffLogFile(sniffer, "baseaircorps_003");\r
- PAssert.That(() => sniffer.BaseAirCorps[1].AirCorps[0].FighterPower[0] == 121);\r
+ SniffLogFile(sniffer, "nightbattlepower_001");\r
+ var ships = sniffer.Fleets[0].ActualShips;\r
+ PAssert.That(() =>\r
+ ships.Select(ship => (int)(ship.NightBattlePower * 100))\r
+ .SequenceEqual(new[] {11202, 14985, 20092, 17354}));\r
+ // 夜間作戦航空要員を外す\r
+ ships[0].FreeSlot(3);\r
+ ships[1].FreeSlot(2);\r
+ ships[3].FreeSlot(2);\r
+ PAssert.That(() =>\r
+ ships.Select(ship => (int)(ship.NightBattlePower * 100))\r
+ .SequenceEqual(new[] {6900, 7500, 20092, 0}));\r
+ // Ark RoyalからSwordfishを外す\r
+ ships[0].FreeSlot(0);\r
+ PAssert.That(() => (int)ships[0].NightBattlePower == 0);\r
}\r
\r
/// <summary>\r
- /// マップ索敵の判定式(33)を正しく計算する\r
+ /// 副砲の改修レベルの効果を計算する\r
/// </summary>\r
[TestMethod]\r
- public void LineOfSight()\r
+ public void SecondaryGunFirepowerLevelBonus()\r
{\r
var sniffer = new Sniffer();\r
- SniffLogFile(sniffer, "lineofsight_001");\r
- PAssert.That(() => Math.Abs(sniffer.GetFleetLineOfSights(0, 1) - 39.45) < 0.01);\r
- PAssert.That(() => Math.Abs(sniffer.GetFleetLineOfSights(0, 3) - 115.19) < 0.01);\r
- PAssert.That(() => Math.Abs(sniffer.GetFleetLineOfSights(0, 4) - 153.06) < 0.01);\r
- SniffLogFile(sniffer, "lineofsight_002");\r
- PAssert.That(() => Math.Abs(sniffer.GetFleetLineOfSights(0, 1) - -25.10) < 0.01, "艦隊に空きがある");\r
+ SniffLogFile(sniffer, "firepower_001");\r
+ var ships = sniffer.Fleets[0].Ships;\r
+ // ReSharper disable CompareOfFloatsByEqualityOperator\r
+ PAssert.That(() => ships[0].EffectiveFirepower == 93.5);\r
+ PAssert.That(() => ships[1].EffectiveFirepower == 82.5);\r
+ // ReSharper restore CompareOfFloatsByEqualityOperator\r
}\r
\r
/// <summary>\r
- /// 触接開始率を正しく計算する\r
+ /// 連合艦隊補正の載った火力を計算する\r
/// </summary>\r
[TestMethod]\r
- public void ContactTriggerRage()\r
+ public void CombinedFleetFirepower()\r
{\r
var sniffer = new Sniffer();\r
- SniffLogFile(sniffer, "contact_001");\r
- PAssert.That(() => Math.Abs(sniffer.GetContactTriggerRate(0) - 1.8182) < 0.0001);\r
+ SniffLogFile(sniffer, "combined_status_001");\r
+ // ReSharper disable CompareOfFloatsByEqualityOperator\r
+ PAssert.That(() => sniffer.Fleets[0].Ships[0].EffectiveFirepower == 117.0);\r
+ PAssert.That(() => sniffer.Fleets[1].Ships[0].EffectiveFirepower == 72.0);\r
+ // ReSharper restore CompareOfFloatsByEqualityOperator\r
}\r
\r
/// <summary>\r
- /// TPを正しく計算する\r
+ /// 対潜攻撃力を計算する\r
/// </summary>\r
[TestMethod]\r
- public void TransportPoint()\r
- {\r
- var sniffer1 = new Sniffer();\r
- SniffLogFile(sniffer1, "transportpoint_001");\r
- ItemSpec.IncreaceLandPowerTp = false;\r
- PAssert.That(() => (int)sniffer1.GetShipStatuses(0).Sum(s => s.TransportPoint) == 27);\r
- ItemSpec.IncreaceLandPowerTp = true;\r
- PAssert.That(() => (int)sniffer1.GetShipStatuses(0).Sum(s => s.TransportPoint) == 37, "陸上戦力揚陸時");\r
-\r
- var sniffer2 = new Sniffer();\r
- SniffLogFile(sniffer2, "transportpoint_002");\r
- PAssert.That(() => (int)sniffer2.GetShipStatuses(0).Sum(s => s.TransportPoint) == 19, "鬼怒改二+特大発+おにぎり");\r
-\r
- var sniffer3 = new Sniffer();\r
- SniffLogFile(sniffer3, "transportpoint_003");\r
- PAssert.That(() => (int)sniffer3.GetShipStatuses(0).Sum(s => s.TransportPoint) == 13, "駆逐艦+士魂部隊");\r
- }\r
-\r
- /// <summary>\r
- /// 対空砲火のパラメータを計算する\r
- /// </summary>\r
- [TestMethod]\r
- public void AntiAirFire()\r
+ public void AntiSubmarine()\r
{\r
var sniffer = new Sniffer();\r
- SniffLogFile(sniffer, "antiairfire_001");\r
- var ships = sniffer.GetShipStatuses(0);\r
- PAssert.That(() => ships.Sum(ship => ship.EffectiveAntiAirForFleet) == 88);\r
- PAssert.That(\r
- () =>\r
- ships.Select(ship => ship.EffectiveAntiAirForShip)\r
- .SequenceEqual(new[] {92, 90, 88, 228, 146, 226}));\r
+ SniffLogFile(sniffer, "antisubmarine_001");\r
+ PAssert.That(() => Abs(sniffer.Fleets[0].Ships[0].EffectiveAntiSubmarine - 92.16) < 0.01);\r
+ PAssert.That(() => Abs(sniffer.Fleets[0].Ships[1].EffectiveAntiSubmarine - 84.49) < 0.01);\r
+ PAssert.That(() => Abs(sniffer.Fleets[0].Ships[2].EffectiveAntiSubmarine - 57.84) < 0.01);\r
+ PAssert.That(() => Abs(sniffer.Fleets[0].Ships[3].EffectiveAntiSubmarine - 61.37) < 0.01);\r
}\r
\r
/// <summary>\r
{\r
var sniffer = new Sniffer();\r
SniffLogFile(sniffer, "deck_001");\r
- var result = sniffer.GetDeck(0);\r
+ var result = sniffer.Fleets[0].Deck;\r
PAssert.That(() => new[] {756, 17204, 6156, 28806, 1069, -1}.SequenceEqual(result));\r
}\r
\r
{\r
var sniffer = new Sniffer();\r
SniffLogFile(sniffer, "deck_005");\r
- var result = sniffer.GetDeck(0);\r
+ var result = sniffer.Fleets[0].Deck;\r
PAssert.That(() => new[] {57391, 50, 24475, 113, -1, -1}.SequenceEqual(result));\r
}\r
\r
var sniffer = new Sniffer();\r
\r
SniffLogFile(sniffer, "deck_002");\r
- var result0 = sniffer.GetDeck(0);\r
+ var result0 = sniffer.Fleets[0].Deck;\r
PAssert.That(() => new[] {1069, 6156, 756, 3223, -1, -1}.SequenceEqual(result0), "編成で艦隊内で艦娘と交換する");\r
\r
SniffLogFile(sniffer, "deck_003");\r
- var result10 = sniffer.GetDeck(0);\r
- var result11 = sniffer.GetDeck(1);\r
+ var result10 = sniffer.Fleets[0].Deck;\r
+ var result11 = sniffer.Fleets[1].Deck;\r
PAssert.That(() => new[] {1069, 6156, 14258, 3223, -1, -1}.SequenceEqual(result10) &&\r
new[] {101, 4487, 756, 14613, 28806, -1}.SequenceEqual(result11), "002に続いて艦隊をまたがって交換する");\r
\r
SniffLogFile(sniffer, "deck_004");\r
- var result20 = sniffer.GetDeck(0);\r
- var result21 = sniffer.GetDeck(1);\r
+ var result20 = sniffer.Fleets[0].Deck;\r
+ var result21 = sniffer.Fleets[1].Deck;\r
PAssert.That(() => new[] {1069, 6156, 14258, 3223, 756, -1}.SequenceEqual(result20) &&\r
new[] {101, 4487, 14613, 28806, -1, -1}.SequenceEqual(result21),\r
"003に続いて空き番号にほかの艦隊の艦娘を配置する");\r
}\r
\r
/// <summary>\r
+ /// 随伴艦一括解除を実行する\r
+ /// </summary>\r
+ [TestMethod]\r
+ public void WithdrawAccompanyingShipsAtOnce()\r
+ {\r
+ var sniffer = new Sniffer();\r
+ SniffLogFile(sniffer, "deck_006");\r
+ var result = sniffer.Fleets[0].Deck;\r
+ PAssert.That(() => new[] {135, -1, -1, -1, -1, -1}.SequenceEqual(result));\r
+ }\r
+\r
+ /// <summary>\r
/// 編成展開を正しく反映する\r
/// </summary>\r
[TestMethod]\r
{\r
var sniffer = new Sniffer();\r
SniffLogFile(sniffer, "preset_001");\r
- var result = sniffer.GetDeck(0);\r
+ var result = sniffer.Fleets[0].Deck;\r
PAssert.That(() => new[] {50510, 632, 39843, 113, 478, 47422}.SequenceEqual(result));\r
}\r
\r
{\r
var sniffer = new Sniffer();\r
SniffLogFile(sniffer, "slot_exchange_001");\r
- var result = sniffer.GetShipStatuses(0)[0].Slot.Select(item => item.Id);\r
+ var result = sniffer.Fleets[0].Ships[0].Slot.Select(item => item.Id);\r
PAssert.That(() => new[] {26096, 30571, 77694, 61383, -1}.SequenceEqual(result));\r
}\r
\r
/// 近代化改修の結果をすぐに反映する\r
/// </summary>\r
[TestMethod]\r
- public void PowerupResult()\r
+ public void PowerUpResult()\r
{\r
var sniffer = new Sniffer();\r
SniffLogFile(sniffer, "powerup_001");\r
- PAssert.That(() => Math.Abs(sniffer.GetShipStatuses(0)[0].EffectiveFirepower - 30) < 0.0001);\r
+ PAssert.That(() => Abs(sniffer.Fleets[0].Ships[0].EffectiveFirepower - 30) < 0.0001);\r
}\r
\r
/// <summary>\r
/// 近代化改修が二重に行われた場合に対応する\r
/// </summary>\r
[TestMethod]\r
- public void DuplicatedPowerup()\r
+ public void DuplicatedPowerUp()\r
{\r
var sniffer = new Sniffer();\r
SniffLogFile(sniffer, "powerup_002");\r
- PAssert.That(() => sniffer.Item.NowShips == 218);\r
+ PAssert.That(() => sniffer.ShipCounter.Now == 218);\r
+ }\r
+\r
+ /// <summary>\r
+ /// ship2を待たずにケッコンの結果を反映する\r
+ /// </summary>\r
+ [TestMethod]\r
+ public void MarriageResult()\r
+ {\r
+ var sniffer = new Sniffer();\r
+ SniffLogFile(sniffer, "marriage_001");\r
+ PAssert.That(() => sniffer.Fleets[0].Ships[2].Level == 100);\r
}\r
\r
/// <summary>\r
{\r
var sniffer1 = new Sniffer();\r
SniffLogFile(sniffer1, "createitem_001");\r
- PAssert.That(() => sniffer1.Item.NowEquips == 900);\r
+ PAssert.That(() => sniffer1.ItemCounter.Now == 900);\r
var sniffer2 = new Sniffer();\r
SniffLogFile(sniffer2, "createship_001");\r
- PAssert.That(() => sniffer2.Item.NowEquips == 904);\r
+ PAssert.That(() => sniffer2.ItemCounter.Now == 904);\r
}\r
\r
/// <summary>\r
[TestMethod]\r
public void WarnItemCount()\r
{\r
+ Action<int> func = i => { };\r
var sniffer1 = new Sniffer();\r
SniffLogFile(sniffer1, "item_count_001");\r
- PAssert.That(() => sniffer1.Item.RingEquips, "出撃から母港に戻ったとき");\r
+ func.Invoke(sniffer1.ItemCounter.Now); // Nowを読まないとAlarmが立たない\r
+ PAssert.That(() => sniffer1.ItemCounter.Alarm, "出撃から母港に戻ったとき");\r
var sniffer2 = new Sniffer();\r
SniffLogFile(sniffer2, "item_count_002");\r
- PAssert.That(() => sniffer2.Item.RingEquips, "ログインしたとき");\r
+ func.Invoke(sniffer2.ItemCounter.Now);\r
+ PAssert.That(() => sniffer2.ItemCounter.Alarm, "ログインしたとき");\r
}\r
\r
/// <summary>\r
SniffLogFile(sniffer, "nyukyo_001");\r
PAssert.That(() => sniffer.RepairList.Length == 1);\r
}\r
+\r
+ /// <summary>\r
+ /// 一括解体する(装備保管なしとあり)\r
+ /// </summary>\r
+ [TestMethod]\r
+ public void DestroyShip()\r
+ {\r
+ var sniffer = new Sniffer();\r
+ SniffLogFile(sniffer, "destroyship_001");\r
+ PAssert.That(() => sniffer.ShipCounter.Now == 250);\r
+ PAssert.That(() => sniffer.ItemCounter.Now == 1118);\r
+ PAssert.That(() => sniffer.Material.Current.Take(4).SequenceEqual(new[] {285615, 286250, 291010, 284744}));\r
+ }\r
+\r
+ /// <summary>\r
+ /// 第2艦隊までしか解放していなくてもエラーにならないようにする\r
+ /// </summary>\r
+ [TestMethod]\r
+ public void TwoFleets()\r
+ {\r
+ var sniffer = new Sniffer(true);\r
+ SniffLogFile(sniffer, "twofleets_001");\r
+ var expected = Enumerable.Repeat(new ChargeStatus(5, 5), ShipInfo.FleetCount);\r
+ PAssert.That(() => expected.SequenceEqual(sniffer.Fleets.Select(f => f.ChargeStatus)));\r
+ }\r
+\r
+ /// <summary>\r
+ /// ship2がリクエストで指定した艦娘のデータしか返さない\r
+ /// </summary>\r
+ [TestMethod]\r
+ public void Ship2ReturnShipSpecifiedByRequest()\r
+ {\r
+ var sniffer = new Sniffer();\r
+ SniffLogFile(sniffer, "ship2_001");\r
+ PAssert.That(() => sniffer.ShipCounter.Now == 243);\r
+ }\r
+\r
+ /// <summary>\r
+ /// 出撃中にアイテムを取得する\r
+ /// </summary>\r
+ [TestMethod]\r
+ public void ItemGetInSortie()\r
+ {\r
+ var sniffer = new Sniffer();\r
+ SniffLogFile(sniffer, "itemget_001");\r
+ PAssert.That(() => sniffer.MiscText ==\r
+ "[獲得アイテム]\r\n" +\r
+ "燃料: 1115\r\n" +\r
+ "弾薬: 25\r\n" +\r
+ "鋼材: 70\r\n" +\r
+ "家具箱(大): 1\r\n" +\r
+ "給糧艦「間宮」: 1\r\n" +\r
+ "勲章: 1\r\n" +\r
+ "給糧艦「伊良湖」: 3\r\n" +\r
+ "プレゼント箱: 1\r\n" +\r
+ "補強増設: 2\r\n" +\r
+ "戦闘詳報: 1\r\n" +\r
+ "瑞雲(六三一空): 1\r\n" +\r
+ "夜間作戦航空要員: 1\r\n" +\r
+ "130mm B-13連装砲: 1\r\n" +\r
+ "潜水空母な桐箪笥: 1\r\n" +\r
+ "Gambier Bay: 1");\r
+ }\r
+\r
+ /// <summary>\r
+ /// 出撃直後に資源を獲得する\r
+ /// </summary>\r
+ [TestMethod]\r
+ public void ItemGetAtStart()\r
+ {\r
+ var sniffer = new Sniffer();\r
+ SniffLogFile(sniffer, "itemget_002");\r
+ PAssert.That(() => sniffer.MiscText ==\r
+ "[獲得アイテム]\r\n" +\r
+ "燃料: 65");\r
+ }\r
+\r
+ /// <summary>\r
+ /// 航空偵察でアイテムを取得する\r
+ /// </summary>\r
+ [TestMethod]\r
+ public void ItemGetInAirRecon()\r
+ {\r
+ var sniffer = new Sniffer();\r
+ SniffLogFile(sniffer, "airrecon_001");\r
+ PAssert.That(() =>\r
+ sniffer.MiscText ==\r
+ "[海域ゲージ情報]\r\n 海域選択画面に進むと表示します。\r\n" +\r
+ "[演習情報]\r\n 演習相手を選ぶと表示します。\r\n" +\r
+ "[獲得アイテム]\r\n 帰投したときに表示します。", "失敗の場合");\r
+\r
+ SniffLogFile(sniffer, "airrecon_002");\r
+ PAssert.That(() =>\r
+ sniffer.MiscText == "[獲得アイテム]\r\n弾薬: 150\r\n開発資材: 1", "成功");\r
+\r
+ SniffLogFile(sniffer, "airrecon_003");\r
+ PAssert.That(() =>\r
+ sniffer.MiscText == "[獲得アイテム]\r\n弾薬: 150\r\n開発資材: 1", "途中でリロードして再出撃");\r
+ }\r
+\r
+ /// <summary>\r
+ /// 海域ゲージの情報を生成する\r
+ /// </summary>\r
+ [TestMethod]\r
+ public void AreaGauge()\r
+ {\r
+ var sniffer = new Sniffer();\r
+ SniffLogFile(sniffer, "mapgauge_001");\r
+ PAssert.That(() =>\r
+ sniffer.MiscText ==\r
+ "[海域ゲージ]\r\n" +\r
+ "1-6 : 残り 5/7\r\n" +\r
+ "2-5 : 残り 4/4\r\n" +\r
+ "3-5 : 残り 4/4\r\n" +\r
+ "4-4 : 残り 4/4\r\n");\r
+ }\r
+\r
+ /// <summary>\r
+ /// 新規のドロップ艦の初期装備数を登録する\r
+ /// </summary>\r
+ [TestMethod]\r
+ public void RecordNumEquipsOfNewDropShip()\r
+ {\r
+ var sniffer = new Sniffer();\r
+ SniffLogFile(sniffer, "dropship_001");\r
+ PAssert.That(() => sniffer.AdditionalData.NumEquips(565) == 2);\r
+ PAssert.That(() => sniffer.ShipList.First(s => s.Spec.Id == 565).Spec.NumEquips == 2);\r
+ }\r
+\r
+ /// <summary>\r
+ /// 既知のドロップ艦とその装備をカウントする\r
+ /// </summary>\r
+ [TestMethod]\r
+ public void CountDropShip()\r
+ {\r
+ var sniffer = new Sniffer();\r
+ sniffer.AdditionalData.RecordNumEquips(11, "", 1);\r
+ SniffLogFile(sniffer, "dropship_002");\r
+ PAssert.That(() => sniffer.ShipCounter.Now == 250);\r
+ PAssert.That(() => sniffer.ItemCounter.Now == 1159);\r
+ }\r
+\r
+ /// <summary>\r
+ /// 艦娘数を数える\r
+ /// </summary>\r
+ [TestMethod]\r
+ public void CountShips()\r
+ {\r
+ var sniffer = new Sniffer();\r
+ SniffLogFile(sniffer, "ship_count_001");\r
+ PAssert.That(() => sniffer.ShipCounter.Now == 267 && sniffer.ShipCounter.Alarm, "ログイン");\r
+ SniffLogFile(sniffer, "ship_count_002");\r
+ PAssert.That(() => sniffer.ShipCounter.Now == 266 && sniffer.ShipCounter.Alarm, "建造");\r
+ SniffLogFile(sniffer, "ship_count_003");\r
+ PAssert.That(() => sniffer.ShipCounter.Now == 266 && sniffer.ShipCounter.Alarm, "ドロップ");\r
+ }\r
}\r
}
\ No newline at end of file