// Copyright (C) 2014 Kazuhiro Fujieda <fujieda@users.osdn.me>\r
// \r
-// This program is part of KancolleSniffer.\r
+// Licensed under the Apache License, Version 2.0 (the "License");\r
+// you may not use this file except in compliance with the License.\r
+// You may obtain a copy of the License at\r
//\r
-// KancolleSniffer is free software: you can redistribute it and/or modify\r
-// it under the terms of the GNU General Public License as published by\r
-// the Free Software Foundation, either version 3 of the License, or\r
-// (at your option) any later version.\r
+// http://www.apache.org/licenses/LICENSE-2.0\r
//\r
-// This program is distributed in the hope that it will be useful,\r
-// but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
-// GNU General Public License for more details.\r
-//\r
-// You should have received a copy of the GNU General Public License\r
-// along with this program; if not, see <http://www.gnu.org/licenses/>.\r
+// Unless required by applicable law or agreed to in writing, software\r
+// distributed under the License is distributed on an "AS IS" BASIS,\r
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+// See the License for the specific language governing permissions and\r
+// limitations under the License.\r
\r
using System;\r
using System.Collections.Generic;\r
using System.IO;\r
using System.IO.Compression;\r
using System.Linq;\r
-using Codeplex.Data;\r
using ExpressionToCodeLib;\r
using Microsoft.VisualStudio.TestTools.UnitTesting;\r
\r
var triple = new List<string>();\r
foreach (var s in new[] {"url: ", "request: ", "response: "})\r
{\r
- var line = stream.ReadLine();\r
- ln++;\r
- if (line == null)\r
- throw new Exception($"ログのurl, request, responseがそろっていません: {ln:d}行目");\r
- if (!line.StartsWith(s))\r
- throw new Exception($"ログに不正な行が含まれています: {ln:d}行目");\r
+ string line;\r
+ do\r
+ {\r
+ line = stream.ReadLine();\r
+ ln++;\r
+ if (line == null)\r
+ throw new Exception($"ログの内容がそろっていません: {ln:d}行目");\r
+ } while (!line.StartsWith(s));\r
triple.Add(line.Substring(s.Length));\r
}\r
- var json = DynamicJson.Parse(triple[2]);\r
+ var json = JsonParser.Parse(triple[2]);\r
sniffer.Sniff(triple[0], triple[1], json);\r
action?.Invoke(sniffer);\r
}\r
}\r
\r
/// <summary>\r
- /// 演習で受けたダメージが次の戦闘の結果に影響しない\r
+ /// 4-2-1で開幕対潜雷撃を含む戦闘を行う\r
/// </summary>\r
[TestMethod]\r
- public void DamageInPracticeNotSpillIntoSortie()\r
+ public void NormalBattleWithVriousTypesOfAttack()\r
{\r
- var expected = new[] {31, 15, 15};\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)));\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
+ /// 開幕夜戦で潜水艦同士がお見合いする\r
/// </summary>\r
[TestMethod]\r
- public void IgnoreDamagedShipsInPractice()\r
+ public void SpMidnightWithoutBattle()\r
{\r
var sniffer = new Sniffer();\r
- SniffLogFile(sniffer, "practice_001");\r
- PAssert.That(() => !sniffer.Battle.HasDamagedShip);\r
+ SniffLogFile(sniffer, "sp_midnight_001");\r
+ PAssert.That(() => sniffer.Battle.ResultRank == BattleResultRank.D);\r
}\r
\r
/// <summary>\r
- /// 夜戦のダメージを戦闘結果に反映する\r
+ /// 夜戦で戦艦が攻撃すると一回で三発分のデータが来る\r
+ /// そのうち存在しない攻撃はターゲット、ダメージともに-1になる\r
/// </summary>\r
[TestMethod]\r
- public void CaptureDamageInNightCombat()\r
+ public void BattleShipAttackInMidnight()\r
{\r
var sniffer = new Sniffer();\r
- SniffLogFile(sniffer, "battle_002");\r
- AssertEqualBattleResult(sniffer, new[] {28, 1, 13});\r
- PAssert.That(() => sniffer.Battle.HasDamagedShip);\r
+ SniffLogFile(sniffer, "midnight_001");\r
+ PAssert.That(() => sniffer.Battle.ResultRank == BattleResultRank.S);\r
}\r
\r
- private void AssertEqualBattleResult(Sniffer sniffer, IEnumerable<int> expected, string msg = null)\r
+ /// <summary>\r
+ /// 7隻編成の戦闘で7隻目が攻撃される\r
+ /// </summary>\r
+ [TestMethod]\r
+ public void Ship7Battle()\r
{\r
- var result = sniffer.GetShipStatuses(0).Select(s => s.NowHp);\r
- PAssert.That(() => (expected.SequenceEqual(result)), msg);\r
+ var sniffer = new Sniffer();\r
+ SniffLogFile(sniffer, "ship7battle_001");\r
+ PAssert.That(() => sniffer.Battle.ResultRank == BattleResultRank.P);\r
}\r
\r
/// <summary>\r
- /// 連合艦隊(水上打撃部隊)による戦闘のダメージを結果に反映する\r
+ /// 演習のあとのportで戦闘結果の検証を行わない\r
/// </summary>\r
[TestMethod]\r
- public void CombinedFleetSurface()\r
+ public void NotVerifyBattleResultAfterPractice()\r
{\r
var sniffer = new Sniffer();\r
- SniffLogFile(sniffer, "combined_surface_001");\r
- AssertEauqlCombinedResult(sniffer, new[] {40, 77, 77, 33, 51, 47}, new[] {39, 35, 11, 39, 37, 40});\r
- PAssert.That(() => !sniffer.Battle.HasDamagedShip);\r
-\r
- SniffLogFile(sniffer, "combined_surface_002");\r
- AssertEauqlCombinedResult(sniffer, new[] {40, 77, 77, 33, 15, 6}, new[] {39, 35, 4, 3, 14, 40});\r
- PAssert.That(() => sniffer.Battle.HasDamagedShip);\r
+ SniffLogFile(sniffer, "practice_001");\r
+ PAssert.That(() => !sniffer.IsBattleResultStatusError);\r
}\r
\r
- private void AssertEauqlCombinedResult(Sniffer sniffer, IEnumerable<int> expected0, IEnumerable<int> expected1,\r
- string msg = null)\r
+ /// <summary>\r
+ /// 連合艦隊が開幕雷撃で被弾する\r
+ /// </summary>\r
+ [TestMethod]\r
+ public void OpeningTorpedoInCombinedBattle()\r
{\r
- var result0 = sniffer.GetShipStatuses(0).Select(s => s.NowHp);\r
- var result1 = sniffer.GetShipStatuses(1).Select(s => s.NowHp);\r
- PAssert.That(() => (expected0.SequenceEqual(result0) && expected1.SequenceEqual(result1)), msg);\r
+ var sniffer = new Sniffer();\r
+ SniffLogFile(sniffer, "combined_battle_001");\r
+ PAssert.That(() => !sniffer.IsBattleResultStatusError);\r
}\r
\r
/// <summary>\r
- /// é\96\8bå¹\95å¤\9cæ\88¦ã\81®ã\83\80ã\83¡ã\83¼ã\82¸ã\82\92æ\88¦é\97\98çµ\90æ\9e\9cã\81«å\8f\8dæ\98 する\r
+ /// é\80£å\90\88è\89¦é\9a\8aã\81\8cé\96\89å¹\95é\9b·æ\92\83ã\81§è¢«å¼¾する\r
/// </summary>\r
[TestMethod]\r
- public void SpMidnight()\r
+ public void ClosingTorpedoInCombinedBattle()\r
{\r
var sniffer = new Sniffer();\r
- SniffLogFile(sniffer, "sp_midnight_001");\r
- AssertEqualBattleResult(sniffer, new[] {1});\r
- PAssert.That(() => sniffer.Battle.HasDamagedShip);\r
+ SniffLogFile(sniffer, "combined_battle_002");\r
+ PAssert.That(() => !sniffer.IsBattleResultStatusError);\r
}\r
\r
/// <summary>\r
- /// 連合艦隊(空母機動部隊)による戦闘のダメージを結果に反映する\r
+ /// 第一が6隻未満の連合艦隊で戦闘する\r
/// </summary>\r
[TestMethod]\r
- public void CombinedFleetAir()\r
+ public void SmallCombinedFleetBattle()\r
{\r
var sniffer = new Sniffer();\r
- SniffLogFile(sniffer, "combined_air_001");\r
- AssertEauqlCombinedResult(sniffer, new[] {40, 98, 90, 66, 78, 86}, new[] {47, 41, 5, 42, 43, 29});\r
- PAssert.That(() => sniffer.Battle.HasDamagedShip);\r
-\r
- SniffLogFile(sniffer, "combined_air_002");\r
- AssertEauqlCombinedResult(sniffer, new[] {13, 87, 90, 59, 69, 86}, new[] {47, 41, 5, 20, 43, 29});\r
+ SniffLogFile(sniffer, "combined_battle_003");\r
+ PAssert.That(() => !sniffer.IsBattleResultStatusError);\r
}\r
\r
/// <summary>\r
- /// è·è¡\9bé\80\80é\81¿ã\82\92æ£ã\81\97ã\81\8få\87¦ç\90\86ã\81\99ã\82\8b\r
+ /// 護衛退避する\r
/// </summary>\r
[TestMethod]\r
- public void EscapeShip()\r
+ public void EscapeWithEscort()\r
{\r
var sniffer = new Sniffer();\r
- SniffLogFile(sniffer, "combined_escape_001");\r
- AssertEauqlCombinedResult(sniffer, new[] {37, 105, 106, 90, 66, 10}, new[] {41, 41, 37, 44, 43, 43},\r
- "連合艦隊で2戦して大破が出るまで");\r
- PAssert.That(() => sniffer.Battle.HasDamagedShip);\r
- SniffLogFile(sniffer, "combined_escape_002");\r
- PAssert.That(() => sniffer.GetShipStatuses(0)[5].Escaped && sniffer.GetShipStatuses(1)[1].Escaped,\r
- "続けて護衛退避を実行");\r
- PAssert.That(() => !sniffer.Battle.HasDamagedShip);\r
- SniffLogFile(sniffer, "combined_escape_003");\r
- AssertEauqlCombinedResult(sniffer, new[] {37, 105, 106, 90, 1, 10}, new[] {41, 41, 32, 44, 43, 43},\r
- "もう一戦して大破が出るまで");\r
- PAssert.That(() => sniffer.Battle.HasDamagedShip);\r
- SniffLogFile(sniffer, "combined_escape_004");\r
- PAssert.That(() => sniffer.GetShipStatuses(0)[5].Escaped && sniffer.GetShipStatuses(1)[1].Escaped &&\r
- sniffer.GetShipStatuses(0)[4].Escaped && sniffer.GetShipStatuses(1)[2].Escaped,\r
- "続けて護衛退避を実行");\r
- PAssert.That(() => !sniffer.Battle.HasDamagedShip);\r
+ SniffLogFile(sniffer, "escape_001");\r
+ PAssert.That(() => sniffer.GetShipStatuses(0)[5].Escaped &&\r
+ sniffer.GetShipStatuses(1)[2].Escaped);\r
}\r
\r
/// <summary>\r
- /// 護衛退避した空母を除いた制空値を計算する\r
+ /// 開幕夜戦に支援が来る\r
/// </summary>\r
[TestMethod]\r
- public void FighterPowerWithoutEscapedShip()\r
+ public void SpMidnightSupportAttack()\r
{\r
var sniffer = new Sniffer();\r
- SniffLogFile(sniffer, "combined_escape_001");\r
- PAssert.That(() => sniffer.GetFighterPower(0, false) == 187);\r
- SniffLogFile(sniffer, "combined_escape_002");\r
- PAssert.That(() => sniffer.GetFighterPower(0, false) == 65);\r
+ SniffLogFile(sniffer, "sp_midnight_002");\r
+ PAssert.That(() => !sniffer.Battle.DisplayedResultRank.IsError);\r
}\r
\r
/// <summary>\r
- /// 夜戦の開始時に昼戦の結果を反映する\r
+ /// 払暁戦を行う\r
/// </summary>\r
[TestMethod]\r
- public void ResultOfDayBattleShowInNightBattle()\r
+ public void NightToDay()\r
{\r
var sniffer = new Sniffer();\r
- SniffLogFile(sniffer, "battle_003");\r
- AssertEqualBattleResult(sniffer, new[] {28, 2, 13});\r
- PAssert.That(() => !sniffer.Battle.HasDamagedShip, "夜戦の開始時は大破警告を出さない");\r
+ SniffLogFile(sniffer, "nighttoday_001");\r
+ PAssert.That(() => !sniffer.Battle.DisplayedResultRank.IsError && !sniffer.IsBattleResultStatusError);\r
}\r
\r
/// <summary>\r
- /// 通常艦隊の航空戦のダメージを結果に反映する\r
+ /// 単艦退避する\r
/// </summary>\r
[TestMethod]\r
- public void AirBattle()\r
+ public void EscapeWithoutEscort()\r
{\r
var sniffer = new Sniffer();\r
- SniffLogFile(sniffer, "airbattle_001");\r
- AssertEqualBattleResult(sniffer, new[] {37, 36, 31, 37, 17, 63}, "夜戦あり");\r
+ SniffLogFile(sniffer, "escape_002");\r
+ PAssert.That(() => sniffer.GetShipStatuses(2)[1].Escaped);\r
+ PAssert.That(() => !sniffer.IsBattleResultStatusError);\r
+ }\r
\r
- sniffer = new Sniffer();\r
- SniffLogFile(sniffer, "airbattle_002");\r
- AssertEqualBattleResult(sniffer, new[] {66, 36, 16, 27, 35, 38}, "昼戦のみ");\r
+ /// <summary>\r
+ /// 出撃時に大破している艦娘がいたら警告する\r
+ /// </summary>\r
+ [TestMethod]\r
+ public void DamagedShipWarningOnMapStart()\r
+ {\r
+ var sniffer = new Sniffer();\r
+ SniffLogFile(sniffer, "mapstart_001");\r
+ PAssert.That(() => sniffer.BadlyDamagedShips.SequenceEqual(new[] {"大潮"}));\r
}\r
\r
/// <summary>\r
- /// 支援射撃による敵の損傷を勝利判定に反映させる\r
+ /// 連合艦隊に大破艦がいる状態で第3艦隊が出撃したときに警告しない\r
/// </summary>\r
[TestMethod]\r
- public void SupportShellingChangeResultRank()\r
+ public void NotWarnDamagedShipInCombinedFleetOnMapStart()\r
{\r
var sniffer = new Sniffer();\r
- SniffLogFile(sniffer, "support_001");\r
- PAssert.That(() => sniffer.Battle.ResultRank == BattleResultRank.A);\r
+ SniffLogFile(sniffer, "mapstart_002");\r
+ PAssert.That(() => !sniffer.BadlyDamagedShips.Any());\r
}\r
\r
/// <summary>\r
- /// ダメコンの使用を戦闘結果に反映させる\r
+ /// 熟練度込みの制空値を正しく計算する\r
/// </summary>\r
[TestMethod]\r
- public void DamageControl()\r
+ public void FighterPowerWithBonus()\r
{\r
var sniffer = new Sniffer();\r
- SniffLogFile(sniffer, "damecon_001");\r
- AssertEqualBattleResult(sniffer, new[] {30, 1, 3}, "戦闘前");\r
- PAssert.That(() => sniffer.GetShipStatuses(0)[1].Slot.Select(item => item.Id).\r
- SequenceEqual(new[] {2, 4593, -1, -1, -1}), "ダメコンを二つ装備");\r
- PAssert.That(() => sniffer.Battle.ResultRank == BattleResultRank.S, "判定はS勝利");\r
- SniffLogFile(sniffer, "damecon_002");\r
- AssertEqualBattleResult(sniffer, new[] {30, 1, 3}, "戦闘後");\r
- PAssert.That(() => sniffer.GetShipStatuses(0)[1].Slot.Select(item => item.Id).\r
- SequenceEqual(new[] {-1, 4593, -1, -1, -1}), "ダメコンを一つ消費");\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
}\r
\r
/// <summary>\r
- /// 補強装備スロットのダメコンの使用を反映する\r
+ /// 改修効果込みの制空値を正しく計算する\r
/// </summary>\r
[TestMethod]\r
- public void DamgeControlInSlotEx()\r
+ public void FighterPowerWithImprovement()\r
{\r
var sniffer = new Sniffer();\r
- SniffLogFile(sniffer, "damecon_003");\r
- PAssert.That(() => sniffer.GetShipStatuses(0)[5].SlotEx.Id == 10306, "戦闘前");\r
- SniffLogFile(sniffer, "damecon_004");\r
- PAssert.That(() => sniffer.GetShipStatuses(0)[5].SlotEx.Id == -1, "戦闘後");\r
+ SniffLogFile(sniffer, "fighterpower_003");\r
+ PAssert.That(() => sniffer.GetFighterPower(0).SequenceEqual(new[] {135, 135}));\r
}\r
\r
/// <summary>\r
- /// 連合艦隊(水上打撃部隊)で二回目の砲撃戦がない場合を正しく処理する\r
+ /// 基地航空隊の制空値を正しく計算する\r
/// </summary>\r
[TestMethod]\r
- // ReSharper disable once InconsistentNaming\r
- public void CombinedFleetSurfaceWithout2ndShelling()\r
+ public void FighterPowerOfBaseAirCorps()\r
{\r
var sniffer = new Sniffer();\r
- SniffLogFile(sniffer, "combined_surface_003");\r
- PAssert.That(() => sniffer.Battle.ResultRank == BattleResultRank.P);\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
- /// ship2に代わるship_deckを処理する\r
+ /// 基地航空隊の防空時の偵察機補正を含む制空値を計算する\r
/// </summary>\r
[TestMethod]\r
- public void ShipDeck()\r
+ public void FighterPowerWithReconBonus()\r
{\r
var sniffer = new Sniffer();\r
- SniffLogFile(sniffer, "ship_deck_001");\r
- PAssert.That(() => sniffer.GetShipStatuses(0)[0].Fuel == 36);\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 ReloadBeforeBattleResult()\r
+ public void FighterPowerOfLandBasedAttackAircraft()\r
{\r
var sniffer = new Sniffer();\r
- SniffLogFile(sniffer, "reload_001");\r
- PAssert.That(() => sniffer.GetShipStatuses(0)[0].NowHp == 41);\r
+ SniffLogFile(sniffer, "baseaircorps_003");\r
+ PAssert.That(() => sniffer.BaseAirCorps[1].AirCorps[0].FighterPower.AirCombat[0] == 121);\r
}\r
\r
/// <summary>\r
- /// 航空戦のない演習を正しく処理する\r
+ /// マップ索敵の判定式(33)を正しく計算する\r
/// </summary>\r
[TestMethod]\r
- public void PracticeWithoutAirBattle()\r
+ public void LineOfSight()\r
{\r
var sniffer = new Sniffer();\r
- SniffLogFile(sniffer, "practice_002");\r
- PAssert.That(() => sniffer.Battle.AirControlLevel == -1);\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
}\r
\r
/// <summary>\r
- /// 熟練度込みの制空値を正しく計算する\r
+ /// 触接開始率を正しく計算する\r
/// </summary>\r
[TestMethod]\r
- public void FighterPowerWithBonus()\r
+ public void ContactTriggerRage()\r
{\r
var sniffer = new Sniffer();\r
- SniffLogFile(sniffer, "fighterpower_001");\r
- PAssert.That(() => sniffer.GetFighterPower(0, true) == 155);\r
- PAssert.That(() => sniffer.GetFighterPower(0, false) == 106);\r
+ SniffLogFile(sniffer, "contact_001");\r
+ PAssert.That(() => Math.Abs(sniffer.GetContactTriggerRate(0) - 1.8182) < 0.0001);\r
}\r
\r
/// <summary>\r
- /// 2-5をクリアしたときの特別戦果を反映する\r
+ /// TPを正しく計算する\r
/// </summary>\r
[TestMethod]\r
- public void ExMapBattleResult()\r
+ public void TransportPoint()\r
{\r
- var sniffer0 = new Sniffer();\r
- sniffer0.ExMap.ClearClearStatus();\r
- SniffLogFile(sniffer0, "eo_001");\r
- PAssert.That(() => sniffer0.ExMap.Achievement == 100, "ほかのマップの情報なし");\r
var sniffer1 = new Sniffer();\r
- SniffLogFile(sniffer1, "eo_001");\r
- // すでに3-5をクリアしているので合計で250\r
- PAssert.That(() => sniffer1.ExMap.Achievement == 250, "ほかのマップの情報あり");\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
- /// 1-6をクリアしたときの特別戦果を反映する\r
+ /// 対空砲火のパラメータを計算する\r
/// </summary>\r
[TestMethod]\r
- public void ExMapMapNext()\r
+ public void AntiAirFire()\r
{\r
- var sniffer0 = new Sniffer();\r
- sniffer0.ExMap.ClearClearStatus();\r
- SniffLogFile(sniffer0, "eo_002");\r
- PAssert.That(() => sniffer0.ExMap.Achievement == 75, "ほかのマップの情報なし");\r
- var sniffer1 = new Sniffer();\r
- SniffLogFile(sniffer1, "eo_002");\r
- // 5-5以外クリアしているので合計で400\r
- PAssert.That(() => sniffer1.ExMap.Achievement == 400, "ほかのマップの情報あり");\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
}\r
\r
/// <summary>\r
}\r
\r
/// <summary>\r
+ /// ドラッグ&ドロップで離れた空き番号を使って編成をローテートする\r
+ /// </summary>\r
+ [TestMethod]\r
+ public void RotateFleetMemberWithDragAndDrop()\r
+ {\r
+ var sniffer = new Sniffer();\r
+ SniffLogFile(sniffer, "deck_005");\r
+ var result = sniffer.GetDeck(0);\r
+ PAssert.That(() => new[] {57391, 50, 24475, 113, -1, -1}.SequenceEqual(result));\r
+ }\r
+\r
+ /// <summary>\r
/// 編成で艦隊に配置ずみの艦娘を交換する\r
/// </summary>\r
[TestMethod]\r
}\r
\r
/// <summary>\r
+ /// 拡張した編成記録枠にすぐに記録してもエラーにならない\r
+ /// </summary>\r
+ [TestMethod]\r
+ public void PresetExpand()\r
+ {\r
+ var sniffer = new Sniffer();\r
+ SniffLogFile(sniffer, "preset_002");\r
+ }\r
+\r
+ /// <summary>\r
/// 装備の交換を正しく反映する\r
/// </summary>\r
[TestMethod]\r
}\r
\r
/// <summary>\r
+ /// 近代化改修の結果をすぐに反映する\r
+ /// </summary>\r
+ [TestMethod]\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
+ }\r
+\r
+ /// <summary>\r
+ /// 近代化改修が二重に行われた場合に対応する\r
+ /// </summary>\r
+ [TestMethod]\r
+ public void DuplicatedPowerup()\r
+ {\r
+ var sniffer = new Sniffer();\r
+ SniffLogFile(sniffer, "powerup_002");\r
+ PAssert.That(() => sniffer.Item.NowShips == 218);\r
+ }\r
+\r
+ /// <summary>\r
/// 改修による資材の減少をすぐに反映する\r
/// </summary>\r
[TestMethod]\r
[TestMethod]\r
public void CountItem()\r
{\r
+ var sniffer1 = new Sniffer();\r
+ SniffLogFile(sniffer1, "createitem_001");\r
+ PAssert.That(() => sniffer1.Item.NowEquips == 900);\r
+ var sniffer2 = new Sniffer();\r
+ SniffLogFile(sniffer2, "createship_001");\r
+ PAssert.That(() => sniffer2.Item.NowEquips == 904);\r
+ }\r
+\r
+ /// <summary>\r
+ /// 装備数の超過を警告する\r
+ /// </summary>\r
+ [TestMethod]\r
+ public void WarnItemCount()\r
+ {\r
+ var sniffer1 = new Sniffer();\r
+ SniffLogFile(sniffer1, "item_count_001");\r
+ PAssert.That(() => sniffer1.Item.RingEquips, "出撃から母港に戻ったとき");\r
+ var sniffer2 = new Sniffer();\r
+ SniffLogFile(sniffer2, "item_count_002");\r
+ PAssert.That(() => sniffer2.Item.RingEquips, "ログインしたとき");\r
+ }\r
+\r
+ /// <summary>\r
+ /// 装備の所持者を設定する\r
+ /// </summary>\r
+ [TestMethod]\r
+ public void SetItemHolder()\r
+ {\r
var sniffer = new Sniffer();\r
- SniffLogFile(sniffer, "createitem_001");\r
- PAssert.That(() => sniffer.Item.NowEquips == 606);\r
+ SniffLogFile(sniffer, "itemholder_001");\r
+ var itemIds = new HashSet<int> {75298, 76572, 82725, 90213, 5910};\r
+ var items = sniffer.ItemList.Where(status => itemIds.Contains(status.Id));\r
+ PAssert.That(() => items.All(x => x.Holder.Id == 861));\r
}\r
\r
/// <summary>\r
/// 資材の変動を正しく反映する\r
/// </summary>\r
[TestMethod]\r
- public void MaterialVariation()\r
+ public void MaterialChanges()\r
{\r
var sniffer1 = new Sniffer();\r
var result1 = new List<int[]>();\r
PAssert.That(() => SequenceOfSequenceEqual(expected2, result2));\r
}\r
\r
+ /// <summary>\r
+ /// 基地航空隊における資材の変動を反映する\r
+ /// </summary>\r
+ [TestMethod]\r
+ public void MaterialChangesInAirCorps()\r
+ {\r
+ var sniffer3 = new Sniffer();\r
+ var result3 = new List<int[]>();\r
+ SniffLogFile(sniffer3, "material_003", sn =>\r
+ {\r
+ var cur = sn.Material.Current;\r
+ if (result3.Count == 0)\r
+ {\r
+ result3.Add(cur);\r
+ }\r
+ else\r
+ {\r
+ if (!result3.Last().SequenceEqual(cur))\r
+ result3.Add(cur);\r
+ }\r
+ });\r
+ var expected3 = new List<int[]>\r
+ {\r
+ new[] {0, 0, 0, 0, 0, 0, 0, 0},\r
+ new[] {288194, 282623, 299496, 295958, 3000, 2968, 2997, 7},\r
+ new[] {288185, 282623, 299496, 295943, 3000, 2968, 2997, 7},\r
+ new[] {288161, 282623, 299496, 295903, 3000, 2968, 2997, 7}\r
+ };\r
+ PAssert.That(() => SequenceOfSequenceEqual(expected3, result3), "航空機の補充");\r
+\r
+ var sniffer4 = new Sniffer();\r
+ var result4 = new List<int[]>();\r
+ SniffLogFile(sniffer4, "material_004", sn =>\r
+ {\r
+ var cur = sn.Material.Current;\r
+ if (result4.Count == 0)\r
+ {\r
+ result4.Add(cur);\r
+ }\r
+ else\r
+ {\r
+ if (!result4.Last().SequenceEqual(cur))\r
+ result4.Add(cur);\r
+ }\r
+ });\r
+ var expected4 = new List<int[]>\r
+ {\r
+ new[] {0, 0, 0, 0, 0, 0, 0, 0},\r
+ new[] {261012, 252252, 298492, 279622, 3000, 2842, 3000, 22},\r
+ new[] {261012, 252252, 298492, 279538, 3000, 2842, 3000, 22},\r
+ new[] {261012, 252252, 298492, 279454, 3000, 2842, 3000, 22}\r
+ };\r
+ PAssert.That(() => SequenceOfSequenceEqual(expected4, result4), "航空機の配備");\r
+ }\r
+\r
private bool SequenceOfSequenceEqual<T>(IEnumerable<IEnumerable<T>> a, IEnumerable<IEnumerable<T>> b)\r
{\r
var aa = a.ToArray();\r
}\r
\r
/// <summary>\r
- /// 海域ゲージ情報を作成する\r
+ /// 修復時間が1分以内の艦娘が入渠する\r
+ /// </summary>\r
+ [TestMethod]\r
+ public void NyukyoLessThanOrEqualTo1Min()\r
+ {\r
+ var sniffer = new Sniffer();\r
+ SniffLogFile(sniffer, "nyukyo_001");\r
+ PAssert.That(() => sniffer.RepairList.Length == 1);\r
+ }\r
+\r
+ /// <summary>\r
+ /// 一括解体する(装備保管なしとあり)\r
/// </summary>\r
[TestMethod]\r
- public void MapInfo()\r
+ public void DestroyShip()\r
{\r
var sniffer = new Sniffer();\r
- SniffLogFile(sniffer, "mapinfo_001");\r
- PAssert.That(() => sniffer.MiscText ==\r
- "[海域ゲージ]\r\n" +\r
- "1-6 : 撃破 3/7\r\n5-5 : 撃破 0/5\r\n6-3 : 撃破 0/4\r\n" +\r
- "31-1 : HP 0/750\r\n31-2 : HP 0/1050\r\n31-3 : HP 0/2100\r\n31-4 : HP 0/3500\r\n31-5 : HP 1/2450\r\n",\r
- "最初の海域ゲージ情報");\r
- SniffLogFile(sniffer, "mapinfo_002");\r
- PAssert.That(() => sniffer.MiscText ==\r
- "[海域ゲージ情報]\r\n 海域選択画面に進むと表示します。\r\n[演習情報]\r\n 演習相手を選ぶと表示します。",\r
- "戦闘から戻ったら案内を表示");\r
- SniffLogFile(sniffer, "mapinfo_003");\r
- PAssert.That(() => sniffer.MiscText ==\r
- "[海域ゲージ]\r\n" +\r
- "1-6 : 撃破 4/7\r\n5-5 : 撃破 0/5\r\n6-3 : 撃破 0/4\r\n" +\r
- "31-1 : HP 0/750\r\n31-2 : HP 0/1050\r\n31-3 : HP 0/2100\r\n31-4 : HP 0/3500\r\n31-5 : HP 1/2450\r\n",\r
- "更新された海域ゲージ情報");\r
+ SniffLogFile(sniffer, "destroyship_001");\r
+ PAssert.That(() => sniffer.Item.NowShips == 250);\r
+ PAssert.That(() => sniffer.Item.NowEquips == 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.ChargeStatuses));\r
}\r
\r
/// <summary>\r
- /// 演習相手の情報を作成する\r
+ /// ship2がリクエストで指定した艦娘のデータしか返さない\r
/// </summary>\r
[TestMethod]\r
- public void PractiveEnemyInfo()\r
+ public void Ship2ReturnShipSpecifiedByRequest()\r
{\r
var sniffer = new Sniffer();\r
- SniffLogFile(sniffer, "practice_enemyinfo_001");\r
- PAssert.That(() => sniffer.MiscText ==\r
- "[演習情報]\r\n敵艦隊名 : 大銀河地球連邦 第7艦隊\r\n獲得経験値 : 570\r\nS勝利 : 684",\r
- "演習相手の情報");\r
- SniffLogFile(sniffer, "practice_enemyinfo_002");\r
- PAssert.That(() => sniffer.MiscText ==\r
- "[海域ゲージ情報]\r\n 海域選択画面に進むと表示します。\r\n[演習情報]\r\n 演習相手を選ぶと表示します。",\r
- "演習から戻ったら案内を表示");\r
+ SniffLogFile(sniffer, "ship2_001");\r
+ PAssert.That(() => sniffer.Item.NowShips == 243);\r
}\r
}\r
}
\ No newline at end of file