HASH 1ff183e0153f
DATE 2025-07-29
SUBJECT nix: add trinket related tests
FILES 7 CHANGED
HASH 1ff183e0153f
DATE 2025-07-29
SUBJECT nix: add trinket related tests
FILES 7 CHANGED
┌─ nix/apps/testEnrichmentOutput.nix ────────────────────────────────────────┐
│ diff --git a/nix/apps/testEnrichmentOutput.nix b/nix/apps/testEnrichmentOutput.nix │
│ index c585342..95efb11 100644 │
│ --- a/nix/apps/testEnrichmentOutput.nix │
│ +++ b/nix/apps/testEnrichmentOutput.nix │
│ @@ -4,40 +4,48 @@ │
│ lib, │
│ ... │
│ }: │
│ - │
│ writeShellApplication { │
│ name = "testEnrichmentOutput"; │
│ text = let │
│ itemDb = lib.sim.itemDatabase; │
│ - │
│ + │
│ # Create a test config similar to what would be in death_knight frost │
│ testConfig = { │
│ class = "death_knight"; │
│ race = "orc"; │
│ equipment = { │
│ items = [ │
│ - { id = 87126; enchant = 4804; gems = [76884 76680]; reforging = 167; } │
│ - { id = 87166; enchant = 4444; gems = [89873]; reforging = 158; } │
│ + { │
│ + id = 87126; │
│ + enchant = 4804; │
│ + gems = [76884 76680]; │
│ + reforging = 167; │
│ + } │
│ + { │
│ + id = 87166; │
│ + enchant = 4444; │
│ + gems = [89873]; │
│ + reforging = 158; │
│ + } │
│ ]; │
│ }; │
│ }; │
│ - │
│ + │
│ enrichedConfig = itemDb.enrichLoadout testConfig; │
│ enrichedConfigJson = builtins.toJSON enrichedConfig; │
│ - │
│ in '' │
│ echo "=== Testing JSON embedding in bash ===" │
│ echo "" │
│ - │
│ + │
│ # Test if the JSON can be used in bash without syntax errors │
│ loadout=$(echo '${enrichedConfigJson}' | jq '{ │
│ equipment, │
│ race, │
│ class │
│ }') │
│ - │
│ + │
│ echo "Success! JSON was processed without bash syntax errors." │
│ echo "Loadout keys:" │
│ echo "$loadout" | jq -r 'keys[]' │
│ ''; │
│ -} │
│ \ No newline at end of file │
│ +} │
└────────────────────────────────────────────────────────────────────────────────────┘
┌─ ...apps/testEnrichmentOutput.nix ───┐
│ diff --git a/nix/apps/testEnrichmentOutput.n │
│ ix b/nix/apps/testEnrichmentOutput.nix │
│ index c585342..95efb11 100644 │
│ --- a/nix/apps/testEnrichmentOutput.nix │
│ +++ b/nix/apps/testEnrichmentOutput.nix │
│ @@ -4,40 +4,48 @@ │
│ lib, │
│ ... │
│ }: │
│ - │
│ writeShellApplication { │
│ name = "testEnrichmentOutput"; │
│ text = let │
│ itemDb = lib.sim.itemDatabase; │
│ - │
│ + │
│ # Create a test config similar to what │
│ would be in death_knight frost │
│ testConfig = { │
│ class = "death_knight"; │
│ race = "orc"; │
│ equipment = { │
│ items = [ │
│ - { id = 87126; enchant = 4804; gem │
│ s = [76884 76680]; reforging = 167; } │
│ - { id = 87166; enchant = 4444; gem │
│ s = [89873]; reforging = 158; } │
│ + { │
│ + id = 87126; │
│ + enchant = 4804; │
│ + gems = [76884 76680]; │
│ + reforging = 167; │
│ + } │
│ + { │
│ + id = 87166; │
│ + enchant = 4444; │
│ + gems = [89873]; │
│ + reforging = 158; │
│ + } │
│ ]; │
│ }; │
│ }; │
│ - │
│ + │
│ enrichedConfig = itemDb.enrichLoadout t │
│ estConfig; │
│ enrichedConfigJson = builtins.toJSON en │
│ richedConfig; │
│ - │
│ in '' │
│ echo "=== Testing JSON embedding in bas │
│ h ===" │
│ echo "" │
│ - │
│ + │
│ # Test if the JSON can be used in bash │
│ without syntax errors │
│ loadout=$(echo '${enrichedConfigJson}' │
│ | jq '{ │
│ equipment, │
│ race, │
│ class │
│ }') │
│ - │
│ + │
│ echo "Success! JSON was processed witho │
│ ut bash syntax errors." │
│ echo "Loadout keys:" │
│ echo "$loadout" | jq -r 'keys[]' │
│ ''; │
│ -} │
│ \ No newline at end of file │
│ +} │
└──────────────────────────────────────────────┘
┌─ nix/apps/testEquipmentEnrichment.nix ─────────────────────────────────────┐
│ diff --git a/nix/apps/testEquipmentEnrichment.nix b/nix/apps/testEquipmentEnrichme │
│ nt.nix │
│ index 5ae055c..21cc53f 100644 │
│ --- a/nix/apps/testEquipmentEnrichment.nix │
│ +++ b/nix/apps/testEquipmentEnrichment.nix │
│ @@ -4,38 +4,46 @@ │
│ lib, │
│ ... │
│ }: │
│ - │
│ writeShellApplication { │
│ name = "testEquipmentEnrichment"; │
│ text = let │
│ itemDb = lib.sim.itemDatabase; │
│ - │
│ + │
│ # Create test equipment similar to what might be in death_knight frost │
│ testEquipment = { │
│ items = [ │
│ - { id = 87126; enchant = 4804; gems = [76884 76680]; reforging = 167; } │
│ - { id = 87166; enchant = 4444; gems = [89873]; reforging = 158; } │
│ + { │
│ + id = 87126; │
│ + enchant = 4804; │
│ + gems = [76884 76680]; │
│ + reforging = 167; │
│ + } │
│ + { │
│ + id = 87166; │
│ + enchant = 4444; │
│ + gems = [89873]; │
│ + reforging = 158; │
│ + } │
│ ]; │
│ }; │
│ - │
│ + │
│ enrichedEquipment = itemDb.enrichEquipment testEquipment; │
│ enrichedEquipmentJson = builtins.toJSON enrichedEquipment; │
│ - │
│ in '' │
│ echo "=== Testing Equipment Enrichment in Bash ===" │
│ echo "" │
│ - │
│ + │
│ # Test the exact pattern used in mkMassSim │
│ enrichedEquipment='${enrichedEquipmentJson}' │
│ - │
│ + │
│ echo "Success! No bash syntax errors with enriched equipment JSON." │
│ echo "Equipment has $(echo "$enrichedEquipment" | jq '.items | length') items │
│ " │
│ - │
│ + │
│ # Test the jq command structure │
│ echo '{"equipment": {}}' | jq --argjson enrichedEquipment "$enrichedEquipment │
│ " '{ │
│ equipment: $enrichedEquipment │
│ }' > /dev/null │
│ - │
│ + │
│ echo "jq command also succeeded!" │
│ ''; │
│ -} │
│ \ No newline at end of file │
│ +} │
└────────────────────────────────────────────────────────────────────────────────────┘
┌─ ...s/testEquipmentEnrichment.nix ───┐
│ diff --git a/nix/apps/testEquipmentEnrichmen │
│ t.nix b/nix/apps/testEquipmentEnrichment.nix │
│ index 5ae055c..21cc53f 100644 │
│ --- a/nix/apps/testEquipmentEnrichment.nix │
│ +++ b/nix/apps/testEquipmentEnrichment.nix │
│ @@ -4,38 +4,46 @@ │
│ lib, │
│ ... │
│ }: │
│ - │
│ writeShellApplication { │
│ name = "testEquipmentEnrichment"; │
│ text = let │
│ itemDb = lib.sim.itemDatabase; │
│ - │
│ + │
│ # Create test equipment similar to what │
│ might be in death_knight frost │
│ testEquipment = { │
│ items = [ │
│ - { id = 87126; enchant = 4804; gems │
│ = [76884 76680]; reforging = 167; } │
│ - { id = 87166; enchant = 4444; gems │
│ = [89873]; reforging = 158; } │
│ + { │
│ + id = 87126; │
│ + enchant = 4804; │
│ + gems = [76884 76680]; │
│ + reforging = 167; │
│ + } │
│ + { │
│ + id = 87166; │
│ + enchant = 4444; │
│ + gems = [89873]; │
│ + reforging = 158; │
│ + } │
│ ]; │
│ }; │
│ - │
│ + │
│ enrichedEquipment = itemDb.enrichEquipm │
│ ent testEquipment; │
│ enrichedEquipmentJson = builtins.toJSON │
│ enrichedEquipment; │
│ - │
│ in '' │
│ echo "=== Testing Equipment Enrichment │
│ in Bash ===" │
│ echo "" │
│ - │
│ + │
│ # Test the exact pattern used in mkMass │
│ Sim │
│ enrichedEquipment='${enrichedEquipmentJ │
│ son}' │
│ - │
│ + │
│ echo "Success! No bash syntax errors wi │
│ th enriched equipment JSON." │
│ echo "Equipment has $(echo "$enrichedEq │
│ uipment" | jq '.items | length') items" │
│ - │
│ + │
│ # Test the jq command structure │
│ echo '{"equipment": {}}' | jq --argjson │
│ enrichedEquipment "$enrichedEquipment" '{ │
│ equipment: $enrichedEquipment │
│ }' > /dev/null │
│ - │
│ + │
│ echo "jq command also succeeded!" │
│ ''; │
│ -} │
│ \ No newline at end of file │
│ +} │
└──────────────────────────────────────────────┘
┌─ nix/apps/testItemLookup.nix ──────────────────────────────────────────────┐
│ diff --git a/nix/apps/testItemLookup.nix b/nix/apps/testItemLookup.nix │
│ index 8a19099..89870eb 100644 │
│ --- a/nix/apps/testItemLookup.nix │
│ +++ b/nix/apps/testItemLookup.nix │
│ @@ -4,52 +4,63 @@ │
│ lib, │
│ ... │
│ }: │
│ - │
│ writeShellApplication { │
│ name = "testItemLookup"; │
│ text = let │
│ itemDb = lib.sim.itemDatabase; │
│ - │
│ + │
│ # Test some item lookups │
│ - testItem1 = itemDb.getItem 87126; # From our example data │
│ + testItem1 = itemDb.getItem 87126; # From our example data │
│ testItem2 = itemDb.getItemName 87166; │
│ testGem = itemDb.getEnrichedGem 76884; │
│ testEnchant = itemDb.getEnchantName 4804; │
│ testReforge = itemDb.getReforgeDescription 167; │
│ - │
│ + │
│ # Create a test loadout structure │
│ testLoadout = { │
│ equipment = { │
│ items = [ │
│ - { id = 87126; enchant = 4804; gems = [76884 76680]; reforging = 167; } │
│ - { id = 87166; enchant = 4444; gems = [89873]; reforging = 158; } │
│ - { id = 89917; reforging = 166; } │
│ + { │
│ + id = 87126; │
│ + enchant = 4804; │
│ + gems = [76884 76680]; │
│ + reforging = 167; │
│ + } │
│ + { │
│ + id = 87166; │
│ + enchant = 4444; │
│ + gems = [89873]; │
│ + reforging = 158; │
│ + } │
│ + { │
│ + id = 89917; │
│ + reforging = 166; │
│ + } │
│ ]; │
│ }; │
│ }; │
│ - │
│ + │
│ enrichedLoadout = itemDb.enrichLoadout testLoadout; │
│ - │
│ in '' │
│ echo "=== Testing Item Database Functions ===" │
│ echo "" │
│ - │
│ + │
│ echo "Test item 87126:" │
│ echo '${builtins.toJSON testItem1}' │
│ echo "" │
│ - │
│ + │
│ echo "Test item name 87166: ${testItem2}" │
│ echo "Test gem 76884:" │
│ echo '${builtins.toJSON testGem}' │
│ echo "Test enchant name 4804: ${testEnchant}" │
│ echo "Test reforge 167: ${testReforge}" │
│ echo "" │
│ - │
│ + │
│ echo "Original loadout:" │
│ echo '${builtins.toJSON testLoadout}' │
│ echo "" │
│ - │
│ + │
│ echo "Enriched loadout:" │
│ echo '${builtins.toJSON enrichedLoadout}' │
│ ''; │
│ -} │
│ \ No newline at end of file │
│ +} │
└────────────────────────────────────────────────────────────────────────────────────┘
┌─ nix/apps/testItemLookup.nix ────────┐
│ diff --git a/nix/apps/testItemLookup.nix b/n │
│ ix/apps/testItemLookup.nix │
│ index 8a19099..89870eb 100644 │
│ --- a/nix/apps/testItemLookup.nix │
│ +++ b/nix/apps/testItemLookup.nix │
│ @@ -4,52 +4,63 @@ │
│ lib, │
│ ... │
│ }: │
│ - │
│ writeShellApplication { │
│ name = "testItemLookup"; │
│ text = let │
│ itemDb = lib.sim.itemDatabase; │
│ - │
│ + │
│ # Test some item lookups │
│ - testItem1 = itemDb.getItem 87126; # Fr │
│ om our example data │
│ + testItem1 = itemDb.getItem 87126; # Fro │
│ m our example data │
│ testItem2 = itemDb.getItemName 87166; │
│ testGem = itemDb.getEnrichedGem 76884; │
│ testEnchant = itemDb.getEnchantName 480 │
│ 4; │
│ testReforge = itemDb.getReforgeDescript │
│ ion 167; │
│ - │
│ + │
│ # Create a test loadout structure │
│ testLoadout = { │
│ equipment = { │
│ items = [ │
│ - { id = 87126; enchant = 4804; gem │
│ s = [76884 76680]; reforging = 167; } │
│ - { id = 87166; enchant = 4444; gem │
│ s = [89873]; reforging = 158; } │
│ - { id = 89917; reforging = 166; } │
│ + { │
│ + id = 87126; │
│ + enchant = 4804; │
│ + gems = [76884 76680]; │
│ + reforging = 167; │
│ + } │
│ + { │
│ + id = 87166; │
│ + enchant = 4444; │
│ + gems = [89873]; │
│ + reforging = 158; │
│ + } │
│ + { │
│ + id = 89917; │
│ + reforging = 166; │
│ + } │
│ ]; │
│ }; │
│ }; │
│ - │
│ + │
│ enrichedLoadout = itemDb.enrichLoadout │
│ testLoadout; │
│ - │
│ in '' │
│ echo "=== Testing Item Database Functio │
│ ns ===" │
│ echo "" │
│ - │
│ + │
│ echo "Test item 87126:" │
│ echo '${builtins.toJSON testItem1}' │
│ echo "" │
│ - │
│ + │
│ echo "Test item name 87166: ${testItem2 │
│ }" │
│ echo "Test gem 76884:" │
│ echo '${builtins.toJSON testGem}' │
│ echo "Test enchant name 4804: ${testEnc │
│ hant}" │
│ echo "Test reforge 167: ${testReforge}" │
│ echo "" │
│ - │
│ + │
│ echo "Original loadout:" │
│ echo '${builtins.toJSON testLoadout}' │
│ echo "" │
│ - │
│ + │
│ echo "Enriched loadout:" │
│ echo '${builtins.toJSON enrichedLoadout │
│ }' │
│ ''; │
│ -} │
│ \ No newline at end of file │
│ +} │
└──────────────────────────────────────────────┘
┌─ nix/apps/trinket-baseline-test.nix ───────────────────────────────────────┐
│ diff --git a/nix/apps/trinket-baseline-test.nix b/nix/apps/trinket-baseline-test.n │
│ ix │
│ new file mode 100644 │
│ index 0000000..f6d1553 │
│ --- /dev/null │
│ +++ b/nix/apps/trinket-baseline-test.nix │
│ @@ -0,0 +1,70 @@ │
│ +{ │
│ + lib, │
│ + pkgs, │
│ + classes, │
│ + encounter, │
│ + buffs, │
│ + debuffs, │
│ + inputs, │
│ + trinket, │
│ + writeShellApplication, │
│ + ... │
│ +}: let │
│ + mkTrinketComparison = │
│ + (import ./simulation/mkTrinketComparison.nix { │
│ + inherit lib pkgs classes encounter buffs debuffs inputs trinket; │
│ + }).mkTrinketComparison; │
│ + │
│ + # Test creating a trinket comparison for windwalker with minimal iterations │
│ + trinketTest = mkTrinketComparison { │
│ + class = "monk"; │
│ + spec = "windwalker"; │
│ + encounter = encounter.raid.long.singleTarget; │
│ + trinketIds = [87167 87057 79328]; # Terror in Mists (heroic), Bottle of Stars │
│ (heroic), Relic of Xuen │
│ + iterations = 100; # Keep very low for testing │
│ + }; │
│ +in │
│ + writeShellApplication { │
│ + name = "trinket-baseline-test"; │
│ + runtimeInputs = [pkgs.jq]; │
│ + text = '' │
│ + echo "=== Running Baseline (No Trinkets) Simulation Test ===" │
│ + echo "Building baseline simulation for Windwalker Monk..." │
│ + echo "" │
│ + │
│ + # Build and run the baseline simulation │
│ + echo "Running baseline simulation..." │
│ + baseline_result=$(nix build --no-link --print-out-paths ${trinketTest.simul │
│ ations.baseline}) │
│ + │
│ + if [ -f "$baseline_result" ]; then │
│ + echo "? Baseline simulation completed successfully!" │
│ + echo "" │
│ + │
│ + echo "=== Baseline Results ===" │
│ + dps=$(jq -r '.dps' "$baseline_result") │
│ + echo "DPS: $dps" │
│ + │
│ + max_dps=$(jq -r '.max' "$baseline_result") │
│ + echo "Max DPS: $max_dps" │
│ + │
│ + min_dps=$(jq -r '.min' "$baseline_result") │
│ + echo "Min DPS: $min_dps" │
│ + │
│ + stdev=$(jq -r '.stdev' "$baseline_result") │
│ + echo "StdDev: $stdev" │
│ + │
│ + echo "" │
│ + echo "=== Equipment Check ===" │
│ + echo "Trinket slots (should be empty):" │
│ + jq -r '.loadout.equipment.items[12:14]' "$baseline_result" │
│ + │
│ + echo "" │
│ + echo "? Baseline test completed!" │
│ + echo "" │
│ + echo "Next: Run 'nix run .#trinket-single-test' to test a single trinket │
│ simulation" │
│ + else │
│ + echo "? Baseline simulation failed!" │
│ + exit 1 │
│ + fi │
│ + ''; │
│ + } │
└────────────────────────────────────────────────────────────────────────────────────┘
┌─ ...pps/trinket-baseline-test.nix ───┐
│ diff --git a/nix/apps/trinket-baseline-test. │
│ nix b/nix/apps/trinket-baseline-test.nix │
│ new file mode 100644 │
│ index 0000000..f6d1553 │
│ --- /dev/null │
│ +++ b/nix/apps/trinket-baseline-test.nix │
│ @@ -0,0 +1,70 @@ │
│ +{ │
│ + lib, │
│ + pkgs, │
│ + classes, │
│ + encounter, │
│ + buffs, │
│ + debuffs, │
│ + inputs, │
│ + trinket, │
│ + writeShellApplication, │
│ + ... │
│ +}: let │
│ + mkTrinketComparison = │
│ + (import ./simulation/mkTrinketCompariso │
│ n.nix { │
│ + inherit lib pkgs classes encounter bu │
│ ffs debuffs inputs trinket; │
│ + }).mkTrinketComparison; │
│ + │
│ + # Test creating a trinket comparison for │
│ windwalker with minimal iterations │
│ + trinketTest = mkTrinketComparison { │
│ + class = "monk"; │
│ + spec = "windwalker"; │
│ + encounter = encounter.raid.long.singleT │
│ arget; │
│ + trinketIds = [87167 87057 79328]; # Ter │
│ ror in Mists (heroic), Bottle of Stars (hero │
│ ic), Relic of Xuen │
│ + iterations = 100; # Keep very low for t │
│ esting │
│ + }; │
│ +in │
│ + writeShellApplication { │
│ + name = "trinket-baseline-test"; │
│ + runtimeInputs = [pkgs.jq]; │
│ + text = '' │
│ + echo "=== Running Baseline (No Trinke │
│ ts) Simulation Test ===" │
│ + echo "Building baseline simulation fo │
│ r Windwalker Monk..." │
│ + echo "" │
│ + │
│ + # Build and run the baseline simulati │
│ on │
│ + echo "Running baseline simulation..." │
│ + baseline_result=$(nix build --no-link │
│ --print-out-paths ${trinketTest.simulations │
│ .baseline}) │
│ + │
│ + if [ -f "$baseline_result" ]; then │
│ + echo "? Baseline simulation complet │
│ ed successfully!" │
│ + echo "" │
│ + │
│ + echo "=== Baseline Results ===" │
│ + dps=$(jq -r '.dps' "$baseline_resul │
│ t") │
│ + echo "DPS: $dps" │
│ + │
│ + max_dps=$(jq -r '.max' "$baseline_r │
│ esult") │
│ + echo "Max DPS: $max_dps" │
│ + │
│ + min_dps=$(jq -r '.min' "$baseline_r │
│ esult") │
│ + echo "Min DPS: $min_dps" │
│ + │
│ + stdev=$(jq -r '.stdev' "$baseline_r │
│ esult") │
│ + echo "StdDev: $stdev" │
│ + │
│ + echo "" │
│ + echo "=== Equipment Check ===" │
│ + echo "Trinket slots (should be empt │
│ y):" │
│ + jq -r '.loadout.equipment.items[12: │
│ 14]' "$baseline_result" │
│ + │
│ + echo "" │
│ + echo "? Baseline test completed!" │
│ + echo "" │
│ + echo "Next: Run 'nix run .#trinket- │
│ single-test' to test a single trinket simula │
│ tion" │
│ + else │
│ + echo "? Baseline simulation failed! │
│ " │
│ + exit 1 │
│ + fi │
│ + ''; │
│ + } │
└──────────────────────────────────────────────┘
┌─ nix/apps/trinket-comparison-test.nix ─────────────────────────────────────┐
│ diff --git a/nix/apps/trinket-comparison-test.nix b/nix/apps/trinket-comparison-te │
│ st.nix │
│ new file mode 100644 │
│ index 0000000..ea0ae23 │
│ --- /dev/null │
│ +++ b/nix/apps/trinket-comparison-test.nix │
│ @@ -0,0 +1,70 @@ │
│ +{ │
│ + lib, │
│ + pkgs, │
│ + classes, │
│ + encounter, │
│ + buffs, │
│ + debuffs, │
│ + inputs, │
│ + trinket, │
│ + writeShellApplication, │
│ + ... │
│ +}: let │
│ + mkTrinketComparison = │
│ + (import ./simulation/mkTrinketComparison.nix { │
│ + inherit lib pkgs classes encounter buffs debuffs inputs trinket; │
│ + }).mkTrinketComparison; │
│ + │
│ + # Test creating a trinket comparison for windwalker with minimal iterations │
│ + trinketTest = mkTrinketComparison { │
│ + class = "monk"; │
│ + spec = "windwalker"; │
│ + encounter = encounter.raid.long.singleTarget; │
│ + trinketIds = trinket.presets.meleeAgility; # Terror in Mists (heroic), Bottle │
│ of Stars (heroic), Relic of Xuen │
│ + iterations = 100; # Keep very low for testing │
│ + }; │
│ +in │
│ + writeShellApplication { │
│ + name = "trinket-comparison-test"; │
│ + runtimeInputs = [pkgs.jq]; │
│ + text = '' │
│ + echo "=== Running Full Trinket Comparison Test ===" │
│ + echo "This will run the aggregation script to combine all trinket results" │
│ + echo "Building aggregation script..." │
│ + echo "" │
│ + │
│ + # Run the aggregation script │
│ + echo "Running trinket comparison aggregation..." │
│ + ${trinketTest.script}/bin/${trinketTest.metadata.output}-aggregator │
│ + │
│ + output_file="${trinketTest.metadata.output}.json" │
│ + │
│ + if [ -f "$output_file" ]; then │
│ + echo "" │
│ + echo "? Full trinket comparison completed successfully!" │
│ + echo "" │
│ + │
│ + echo "=== Final Results Summary ===" │
│ + echo "Metadata:" │
│ + jq -r '.metadata | "Class: \(.class), Spec: \(.spec), Trinkets: \(.trinke │
│ tCategory), Iterations: \(.iterations)"' "$output_file" │
│ + │
│ + echo "" │
│ + echo "Baseline DPS:" │
│ + jq -r '.results.baseline.dps' "$output_file" │
│ + │
│ + echo "" │
│ + echo "Top 3 Trinkets:" │
│ + jq -r '.results | to_entries[] | select(.key != "baseline") | "\(.value.t │
│ rinket.name): \(.value.dps | floor) DPS"' "$output_file" | sort -k2 -nr | head -3 │
│ + │
│ + echo "" │
│ + echo "Output written to: $output_file" │
│ + echo "" │
│ + echo "? Full trinket comparison test completed!" │
│ + echo "" │
│ + echo "You can now examine the complete JSON output or run individual test │
│ s again." │
│ + else │
│ + echo "? Trinket comparison aggregation failed!" │
│ + exit 1 │
│ + fi │
│ + ''; │
│ + } │
└────────────────────────────────────────────────────────────────────────────────────┘
┌─ ...s/trinket-comparison-test.nix ───┐
│ diff --git a/nix/apps/trinket-comparison-tes │
│ t.nix b/nix/apps/trinket-comparison-test.nix │
│ new file mode 100644 │
│ index 0000000..ea0ae23 │
│ --- /dev/null │
│ +++ b/nix/apps/trinket-comparison-test.nix │
│ @@ -0,0 +1,70 @@ │
│ +{ │
│ + lib, │
│ + pkgs, │
│ + classes, │
│ + encounter, │
│ + buffs, │
│ + debuffs, │
│ + inputs, │
│ + trinket, │
│ + writeShellApplication, │
│ + ... │
│ +}: let │
│ + mkTrinketComparison = │
│ + (import ./simulation/mkTrinketCompariso │
│ n.nix { │
│ + inherit lib pkgs classes encounter bu │
│ ffs debuffs inputs trinket; │
│ + }).mkTrinketComparison; │
│ + │
│ + # Test creating a trinket comparison for │
│ windwalker with minimal iterations │
│ + trinketTest = mkTrinketComparison { │
│ + class = "monk"; │
│ + spec = "windwalker"; │
│ + encounter = encounter.raid.long.singleT │
│ arget; │
│ + trinketIds = trinket.presets.meleeAgili │
│ ty; # Terror in Mists (heroic), Bottle of St │
│ ars (heroic), Relic of Xuen │
│ + iterations = 100; # Keep very low for t │
│ esting │
│ + }; │
│ +in │
│ + writeShellApplication { │
│ + name = "trinket-comparison-test"; │
│ + runtimeInputs = [pkgs.jq]; │
│ + text = '' │
│ + echo "=== Running Full Trinket Compar │
│ ison Test ===" │
│ + echo "This will run the aggregation s │
│ cript to combine all trinket results" │
│ + echo "Building aggregation script..." │
│ + echo "" │
│ + │
│ + # Run the aggregation script │
│ + echo "Running trinket comparison aggr │
│ egation..." │
│ + ${trinketTest.script}/bin/${trinketTe │
│ st.metadata.output}-aggregator │
│ + │
│ + output_file="${trinketTest.metadata.o │
│ utput}.json" │
│ + │
│ + if [ -f "$output_file" ]; then │
│ + echo "" │
│ + echo "? Full trinket comparison com │
│ pleted successfully!" │
│ + echo "" │
│ + │
│ + echo "=== Final Results Summary === │
│ " │
│ + echo "Metadata:" │
│ + jq -r '.metadata | "Class: \(.class │
│ ), Spec: \(.spec), Trinkets: \(.trinketCateg │
│ ory), Iterations: \(.iterations)"' "$output_ │
│ file" │
│ + │
│ + echo "" │
│ + echo "Baseline DPS:" │
│ + jq -r '.results.baseline.dps' "$out │
│ put_file" │
│ + │
│ + echo "" │
│ + echo "Top 3 Trinkets:" │
│ + jq -r '.results | to_entries[] | se │
│ lect(.key != "baseline") | "\(.value.trinket │
│ .name): \(.value.dps | floor) DPS"' "$output │
│ _file" | sort -k2 -nr | head -3 │
│ + │
│ + echo "" │
│ + echo "Output written to: $output_fi │
│ le" │
│ + echo "" │
│ + echo "? Full trinket comparison tes │
│ t completed!" │
│ + echo "" │
│ + echo "You can now examine the compl │
│ ete JSON output or run individual tests agai │
│ n." │
│ + else │
│ + echo "? Trinket comparison aggregat │
│ ion failed!" │
│ + exit 1 │
│ + fi │
│ + ''; │
│ + } │
└──────────────────────────────────────────────┘
┌─ nix/apps/trinket-single-test.nix ─────────────────────────────────────────┐
│ diff --git a/nix/apps/trinket-single-test.nix b/nix/apps/trinket-single-test.nix │
│ new file mode 100644 │
│ index 0000000..f3661a6 │
│ --- /dev/null │
│ +++ b/nix/apps/trinket-single-test.nix │
│ @@ -0,0 +1,77 @@ │
│ +{ │
│ + lib, │
│ + pkgs, │
│ + classes, │
│ + encounter, │
│ + buffs, │
│ + debuffs, │
│ + inputs, │
│ + trinket, │
│ + writeShellApplication, │
│ + ... │
│ +}: let │
│ + mkTrinketComparison = │
│ + (import ./simulation/mkTrinketComparison.nix { │
│ + inherit lib pkgs classes encounter buffs debuffs inputs trinket; │
│ + }).mkTrinketComparison; │
│ + │
│ + # Test creating a trinket comparison for windwalker with minimal iterations │
│ + trinketTest = mkTrinketComparison { │
│ + class = "monk"; │
│ + spec = "windwalker"; │
│ + encounter = encounter.raid.long.singleTarget; │
│ + trinketIds = [87167 87057 79328]; # Terror in Mists (heroic), Bottle of Stars │
│ (heroic), Relic of Xuen │
│ + iterations = 100; # Keep very low for testing │
│ + }; │
│ + │
│ + # Get the first trinket simulation for testing (Terror in the Mists Celestial) │
│ + testTrinketName = builtins.head (builtins.attrNames (builtins.removeAttrs trink │
│ etTest.simulations ["baseline"])); │
│ +in │
│ + writeShellApplication { │
│ + name = "trinket-single-test"; │
│ + runtimeInputs = [pkgs.jq]; │
│ + text = '' │
│ + echo "=== Running Single Trinket Simulation Test ===" │
│ + echo "Building single trinket simulation for Windwalker Monk..." │
│ + echo "Testing trinket: ${testTrinketName}" │
│ + echo "" │
│ + │
│ + # Build and run the single trinket simulation │
│ + echo "Running trinket simulation..." │
│ + trinket_result=$(nix build --no-link --print-out-paths ${trinketTest.simula │
│ tions.${testTrinketName}}) │
│ + │
│ + if [ -f "$trinket_result" ]; then │
│ + echo "? Trinket simulation completed successfully!" │
│ + echo "" │
│ + │
│ + echo "=== Trinket Results ===" │
│ + trinket_name=$(jq -r '.trinket.name' "$trinket_result") │
│ + trinket_id=$(jq -r '.trinket.id' "$trinket_result") │
│ + echo "Trinket: $trinket_name (ID: $trinket_id)" │
│ + │
│ + dps=$(jq -r '.dps' "$trinket_result") │
│ + echo "DPS: $dps" │
│ + │
│ + max_dps=$(jq -r '.max' "$trinket_result") │
│ + echo "Max DPS: $max_dps" │
│ + │
│ + min_dps=$(jq -r '.min' "$trinket_result") │
│ + echo "Min DPS: $min_dps" │
│ + │
│ + echo "" │
│ + echo "=== Equipment Check ===" │
│ + echo "Trinket in slot 13 (should contain the trinket):" │
│ + jq -r '.loadout.equipment.items[12]' "$trinket_result" │
│ + echo "Trinket in slot 14 (should be empty):" │
│ + jq -r '.loadout.equipment.items[13]' "$trinket_result" │
│ + │
│ + echo "" │
│ + echo "? Single trinket test completed!" │
│ + echo "" │
│ + echo "Next: Run 'nix run .#trinket-comparison-test' to test the full comp │
│ arison with aggregation" │
│ + else │
│ + echo "? Trinket simulation failed!" │
│ + exit 1 │
│ + fi │
│ + ''; │
│ + } │
└────────────────────────────────────────────────────────────────────────────────────┘
┌─ nix/apps/trinket-single-test.nix ───┐
│ diff --git a/nix/apps/trinket-single-test.ni │
│ x b/nix/apps/trinket-single-test.nix │
│ new file mode 100644 │
│ index 0000000..f3661a6 │
│ --- /dev/null │
│ +++ b/nix/apps/trinket-single-test.nix │
│ @@ -0,0 +1,77 @@ │
│ +{ │
│ + lib, │
│ + pkgs, │
│ + classes, │
│ + encounter, │
│ + buffs, │
│ + debuffs, │
│ + inputs, │
│ + trinket, │
│ + writeShellApplication, │
│ + ... │
│ +}: let │
│ + mkTrinketComparison = │
│ + (import ./simulation/mkTrinketCompariso │
│ n.nix { │
│ + inherit lib pkgs classes encounter bu │
│ ffs debuffs inputs trinket; │
│ + }).mkTrinketComparison; │
│ + │
│ + # Test creating a trinket comparison for │
│ windwalker with minimal iterations │
│ + trinketTest = mkTrinketComparison { │
│ + class = "monk"; │
│ + spec = "windwalker"; │
│ + encounter = encounter.raid.long.singleT │
│ arget; │
│ + trinketIds = [87167 87057 79328]; # Ter │
│ ror in Mists (heroic), Bottle of Stars (hero │
│ ic), Relic of Xuen │
│ + iterations = 100; # Keep very low for t │
│ esting │
│ + }; │
│ + │
│ + # Get the first trinket simulation for te │
│ sting (Terror in the Mists Celestial) │
│ + testTrinketName = builtins.head (builtins │
│ .attrNames (builtins.removeAttrs trinketTest │
│ .simulations ["baseline"])); │
│ +in │
│ + writeShellApplication { │
│ + name = "trinket-single-test"; │
│ + runtimeInputs = [pkgs.jq]; │
│ + text = '' │
│ + echo "=== Running Single Trinket Simu │
│ lation Test ===" │
│ + echo "Building single trinket simulat │
│ ion for Windwalker Monk..." │
│ + echo "Testing trinket: ${testTrinketN │
│ ame}" │
│ + echo "" │
│ + │
│ + # Build and run the single trinket si │
│ mulation │
│ + echo "Running trinket simulation..." │
│ + trinket_result=$(nix build --no-link │
│ --print-out-paths ${trinketTest.simulations. │
│ ${testTrinketName}}) │
│ + │
│ + if [ -f "$trinket_result" ]; then │
│ + echo "? Trinket simulation complete │
│ d successfully!" │
│ + echo "" │
│ + │
│ + echo "=== Trinket Results ===" │
│ + trinket_name=$(jq -r '.trinket.name │
│ ' "$trinket_result") │
│ + trinket_id=$(jq -r '.trinket.id' "$ │
│ trinket_result") │
│ + echo "Trinket: $trinket_name (ID: $ │
│ trinket_id)" │
│ + │
│ + dps=$(jq -r '.dps' "$trinket_result │
│ ") │
│ + echo "DPS: $dps" │
│ + │
│ + max_dps=$(jq -r '.max' "$trinket_re │
│ sult") │
│ + echo "Max DPS: $max_dps" │
│ + │
│ + min_dps=$(jq -r '.min' "$trinket_re │
│ sult") │
│ + echo "Min DPS: $min_dps" │
│ + │
│ + echo "" │
│ + echo "=== Equipment Check ===" │
│ + echo "Trinket in slot 13 (should co │
│ ntain the trinket):" │
│ + jq -r '.loadout.equipment.items[12] │
│ ' "$trinket_result" │
│ + echo "Trinket in slot 14 (should be │
│ empty):" │
│ + jq -r '.loadout.equipment.items[13] │
│ ' "$trinket_result" │
│ + │
│ + echo "" │
│ + echo "? Single trinket test complet │
│ ed!" │
│ + echo "" │
│ + echo "Next: Run 'nix run .#trinket- │
│ comparison-test' to test the full comparison │
│ with aggregation" │
│ + else │
│ + echo "? Trinket simulation failed!" │
│ + exit 1 │
│ + fi │
│ + ''; │
│ + } │
└──────────────────────────────────────────────┘
┌─ nix/apps/trinket-test.nix ────────────────────────────────────────────────┐
│ diff --git a/nix/apps/trinket-test.nix b/nix/apps/trinket-test.nix │
│ new file mode 100644 │
│ index 0000000..6d3c317 │
│ --- /dev/null │
│ +++ b/nix/apps/trinket-test.nix │
│ @@ -0,0 +1,56 @@ │
│ +{ │
│ + lib, │
│ + pkgs, │
│ + classes, │
│ + encounter, │
│ + buffs, │
│ + debuffs, │
│ + inputs, │
│ + trinket, │
│ + writeShellApplication, │
│ + ... │
│ +}: let │
│ + mkTrinketComparison = │
│ + (import ./simulation/mkTrinketComparison.nix { │
│ + inherit lib pkgs classes encounter buffs debuffs inputs trinket; │
│ + }).mkTrinketComparison; │
│ + │
│ + # Test creating a trinket comparison for windwalker with minimal iterations │
│ + # Use direct trinket IDs to avoid path issues for now │
│ + trinketTest = mkTrinketComparison { │
│ + class = "monk"; │
│ + spec = "windwalker"; │
│ + encounter = encounter.raid.long.singleTarget; │
│ + trinketIds = [87167 87057 79328]; # Terror in Mists (heroic), Bottle of Stars │
│ (heroic), Relic of Xuen │
│ + iterations = 100; # Keep low for testing │
│ + }; │
│ +in │
│ + writeShellApplication { │
│ + name = "trinket-test"; │
│ + text = '' │
│ + echo "=== Trinket Comparison Test ===" │
│ + echo "Class: ${trinketTest.metadata.class}" │
│ + echo "Spec: ${trinketTest.metadata.spec}" │
│ + echo "Trinket Category: ${trinketTest.metadata.trinketCategory}" │
│ + echo "Trinket Count: ${toString trinketTest.metadata.trinketCount}" │
│ + echo "Output File: ${trinketTest.metadata.output}.json" │
│ + echo "" │
│ + │
│ + echo "=== Trinket IDs ===" │
│ + ${lib.concatMapStringsSep "\n" ( │
│ + trinketId: "echo \"- ${toString trinketId}\"" │
│ + ) │
│ + trinketTest.metadata.trinkets} │
│ + echo "" │
│ + │
│ + echo "=== Available Simulations ===" │
│ + ${lib.concatMapStringsSep "\n" ( │
│ + simName: "echo \"- ${simName}\"" │
│ + ) (builtins.attrNames trinketTest.simulations)} │
│ + echo "" │
│ + │
│ + echo "=== Test Structure Complete ===" │
│ + echo "Run 'nix run .#trinket-baseline-test' to test just the baseline simul │
│ ation" │
│ + echo "This test app validates that the trinket comparison structure is work │
│ ing" │
│ + ''; │
│ + } │
└────────────────────────────────────────────────────────────────────────────────────┘
┌─ nix/apps/trinket-test.nix ──────────┐
│ diff --git a/nix/apps/trinket-test.nix b/nix │
│ /apps/trinket-test.nix │
│ new file mode 100644 │
│ index 0000000..6d3c317 │
│ --- /dev/null │
│ +++ b/nix/apps/trinket-test.nix │
│ @@ -0,0 +1,56 @@ │
│ +{ │
│ + lib, │
│ + pkgs, │
│ + classes, │
│ + encounter, │
│ + buffs, │
│ + debuffs, │
│ + inputs, │
│ + trinket, │
│ + writeShellApplication, │
│ + ... │
│ +}: let │
│ + mkTrinketComparison = │
│ + (import ./simulation/mkTrinketCompariso │
│ n.nix { │
│ + inherit lib pkgs classes encounter bu │
│ ffs debuffs inputs trinket; │
│ + }).mkTrinketComparison; │
│ + │
│ + # Test creating a trinket comparison for │
│ windwalker with minimal iterations │
│ + # Use direct trinket IDs to avoid path is │
│ sues for now │
│ + trinketTest = mkTrinketComparison { │
│ + class = "monk"; │
│ + spec = "windwalker"; │
│ + encounter = encounter.raid.long.singleT │
│ arget; │
│ + trinketIds = [87167 87057 79328]; # Ter │
│ ror in Mists (heroic), Bottle of Stars (hero │
│ ic), Relic of Xuen │
│ + iterations = 100; # Keep low for testin │
│ g │
│ + }; │
│ +in │
│ + writeShellApplication { │
│ + name = "trinket-test"; │
│ + text = '' │
│ + echo "=== Trinket Comparison Test === │
│ " │
│ + echo "Class: ${trinketTest.metadata.c │
│ lass}" │
│ + echo "Spec: ${trinketTest.metadata.sp │
│ ec}" │
│ + echo "Trinket Category: ${trinketTest │
│ .metadata.trinketCategory}" │
│ + echo "Trinket Count: ${toString trink │
│ etTest.metadata.trinketCount}" │
│ + echo "Output File: ${trinketTest.meta │
│ data.output}.json" │
│ + echo "" │
│ + │
│ + echo "=== Trinket IDs ===" │
│ + ${lib.concatMapStringsSep "\n" ( │
│ + trinketId: "echo \"- ${toString t │
│ rinketId}\"" │
│ + ) │
│ + trinketTest.metadata.trinkets} │
│ + echo "" │
│ + │
│ + echo "=== Available Simulations ===" │
│ + ${lib.concatMapStringsSep "\n" ( │
│ + simName: "echo \"- ${simName}\"" │
│ + ) (builtins.attrNames trinketTest.sim │
│ ulations)} │
│ + echo "" │
│ + │
│ + echo "=== Test Structure Complete === │
│ " │
│ + echo "Run 'nix run .#trinket-baseline │
│ -test' to test just the baseline simulation" │
│ + echo "This test app validates that th │
│ e trinket comparison structure is working" │
│ + ''; │
│ + } │
└──────────────────────────────────────────────┘
[ BACK TO LOG ]
──────────────────────────────────────────────────────────────────────────────────────
OOKNET
────────────────────────────────────────────────
OOKNET