add C++, Typescript and more stuff
This commit is contained in:
@@ -249,7 +249,7 @@ public class CardCatalogTests
|
||||
public void CatalogCoversEveryPersistedCardIncludingTokenAndReturnsFreshRuntimeEffects()
|
||||
{
|
||||
Assert.That(CardCatalog.Entries.Select(entry => entry.Id), Is.EquivalentTo(Database.AllCards.Select(card => card.Id)));
|
||||
Assert.That(CardCatalog.Entries.Select(entry => entry.Id).Distinct().Count(), Is.EqualTo(110));
|
||||
Assert.That(CardCatalog.Entries.Select(entry => entry.Id).Distinct().Count(), Is.EqualTo(132));
|
||||
foreach (var entry in CardCatalog.Entries)
|
||||
{
|
||||
var first = entry.CreateEffects();
|
||||
|
||||
@@ -155,9 +155,9 @@ public class GentooHaskellTests
|
||||
[Test]
|
||||
public void RegistriesContainOnlyRealDefinitionsIncludingTheTwoRepairedPythonCards()
|
||||
{
|
||||
Assert.That(_cards.AllCards, Has.Count.EqualTo(110));
|
||||
Assert.That(_cards.AllCards, Has.Count.EqualTo(132));
|
||||
Assert.That(_cards.AllCards.All(c => c != null), Is.True);
|
||||
Assert.That(_cards.AllCards.Select(c => c.Id).Distinct().Count(), Is.EqualTo(110));
|
||||
Assert.That(_cards.AllCards.Select(c => c.Id).Distinct().Count(), Is.EqualTo(132));
|
||||
Assert.That(Card("shop_py_list_append").Definition.DisplayName, Is.Not.Empty);
|
||||
Assert.That(Card("shop_py_async_def").Definition.DisplayName, Is.Not.Empty);
|
||||
var distros = Asset<DistroDatabase>("Assets/Data/Distros/DistroDatabase.asset");
|
||||
|
||||
@@ -126,6 +126,31 @@ public class RewardSettlementTests
|
||||
|
||||
private void Settle() => typeof(CombatSceneController).GetMethod("SettleRunRewardsIfNeeded", Private).Invoke(_controller, null);
|
||||
|
||||
[Test]
|
||||
public void CampaignUnlockCommitsBeforeEndlessAndFailedSaveNeverAnnouncesSuccess()
|
||||
{
|
||||
_save.Save(SaveData.CreateDefault());
|
||||
Set(_run, "_wavesCleared", 10);
|
||||
Set(_run, "currentWaveNumber", 11);
|
||||
Directory.CreateDirectory(_save.BackupPath);
|
||||
var persist = typeof(CombatSceneController).GetMethod("PersistCampaignUnlocks", Private);
|
||||
persist.Invoke(_controller, null);
|
||||
Assert.That(_save.Load().campaignClearLanguages, Is.Empty);
|
||||
Assert.That(Get<bool>(_controller, "_campaignUnlocksSaved"), Is.False);
|
||||
Assert.That(Get<string>(_controller, "_campaignUnlockNotice"), Is.Null);
|
||||
Assert.That(Get<string>(_controller, "_campaignUnlockError"), Is.Not.Empty);
|
||||
Directory.Delete(_save.BackupPath);
|
||||
persist.Invoke(_controller, null);
|
||||
Assert.That(_save.Load().campaignClearLanguages, Is.EquivalentTo(new[] { Language.C }));
|
||||
Assert.That(Get<string>(_controller, "_campaignUnlockNotice"), Does.Contain("C++"));
|
||||
Assert.That(_run.RewardsSettled, Is.False, "Unlocking must not bank or finish the run.");
|
||||
Assert.That(_run.IsRunActive, Is.True);
|
||||
string committed = File.ReadAllText(_save.SavePath);
|
||||
_run.Journey.endless = true;
|
||||
persist.Invoke(_controller, null);
|
||||
Assert.That(File.ReadAllText(_save.SavePath), Is.EqualTo(committed));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CampaignVictorySaveFailureCanRetryWithoutDuplicateRewardsOrHistory()
|
||||
{
|
||||
|
||||
@@ -142,7 +142,7 @@ public class RunCheckpointTests
|
||||
var resume = Prepare();
|
||||
_run.RestoreCheckpoint(resume);
|
||||
Assert.That(_run.BuildRewardPending, Is.True);
|
||||
Assert.That(_run.Journey.encounterRevision, Is.EqualTo(2));
|
||||
Assert.That(_run.Journey.encounterRevision, Is.EqualTo(3));
|
||||
int bits = _run.Bits;
|
||||
Assert.That(_run.ClaimBuildReward(null, CardUpgradeKind.MagnitudeUp, true), Is.True);
|
||||
RunCheckpointService.SaveAndSuspend(_saves, _run, _combat);
|
||||
@@ -317,13 +317,39 @@ public class RunCheckpointTests
|
||||
|
||||
private ResolvedRunCheckpoint Prepare() => RunCheckpointService.PrepareResume(_saves, _distros, _cards, _languages, _packages);
|
||||
|
||||
[Test]
|
||||
public void RunStatisticsSurviveCheckpointAndResumeWithoutResetOrAliasing()
|
||||
{
|
||||
_run.Performance.damageDealt = 321;
|
||||
_run.Performance.RecordPlay(_run.RunDeck[0]);
|
||||
RunCheckpointService.SaveAndSuspend(_saves, _run, _combat);
|
||||
var resume = Prepare();
|
||||
_run.RestoreCheckpoint(resume);
|
||||
Assert.That(_run.Performance.damageDealt, Is.EqualTo(321));
|
||||
Assert.That(_run.Performance.cardsPlayed, Is.EqualTo(1));
|
||||
_run.Performance.RecordPlay(_run.RunDeck[0]);
|
||||
Assert.That(resume.Snapshot.performance.cardsPlayed, Is.EqualTo(1), "Resume uses an independent copy.");
|
||||
RunCheckpointService.SaveAndSuspend(_saves, _run, _combat);
|
||||
Assert.That(Prepare().Snapshot.performance.cardsPlayed, Is.EqualTo(2));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void LegacyCheckpointWithoutStatisticsMarksCoverageAsPartial()
|
||||
{
|
||||
var snapshot = _run.CaptureCheckpoint(_combat);
|
||||
snapshot.version = 4; snapshot.performance = null;
|
||||
_run.RestoreCheckpoint(snapshot.Resolve(_distros, _cards, _languages, _packages));
|
||||
Assert.That(_run.Performance.complete, Is.False);
|
||||
Assert.That(_run.Performance.cardsPlayed, Is.Zero);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CheckpointPreservesRouteChoiceWithoutGrantingRepairOrChallengeTwice()
|
||||
{
|
||||
Assert.That(_run.SelectRoute(WaveRoute.Challenge), Is.True);
|
||||
RunCheckpointService.SaveAndSuspend(_saves, _run, _combat);
|
||||
var restored = Prepare();
|
||||
Assert.That(restored.Snapshot.version, Is.EqualTo(4));
|
||||
Assert.That(restored.Snapshot.version, Is.EqualTo(5));
|
||||
_run.RestoreCheckpoint(restored);
|
||||
_combat.RestoreBoundaryState(restored.Config, restored.Snapshot.combat);
|
||||
Assert.That(_run.Journey.campaign, Is.True);
|
||||
|
||||
Reference in New Issue
Block a user