Skip to content

Commit

Permalink
now we're just messing around
Browse files Browse the repository at this point in the history
  • Loading branch information
mlangsdorf committed Apr 18, 2020
1 parent 93296d2 commit 72770fb
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions tests/effective_dps_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,15 @@ static void check_accuracy_dps( avatar &attacker, monster &defender, item &wpn1,
double wpn2_hit_rate = static_cast<double>( wpn2_stats.hit_count ) / wpn2_stats.attack_count;
double wpn3_hit_rate = static_cast<double>( wpn3_stats.hit_count ) / wpn3_stats.attack_count;
CHECK( wpn2_hit_rate > wpn1_hit_rate );
if( wpn2_hit_rate <= wpn1_hit_rate ) {
std::cout << "wpn 2 hits " << wpn2_stats.hit_count << " / " << wpn2_stats.attack_count << std::endl;
std::cout << "wpn 1 hits " << wpn1_stats.hit_count << " / " << wpn1_stats.attack_count << std::endl;
}
CHECK( wpn3_hit_rate > wpn2_hit_rate );
if( wpn3_hit_rate <= wpn2_hit_rate ) {
std::cout << "wpn 3 hits " << wpn3_stats.hit_count << " / " << wpn3_stats.attack_count << std::endl;
std::cout << "wpn 2 hits " << wpn2_stats.hit_count << " / " << wpn2_stats.attack_count << std::endl;
}
CHECK( dps_wpn2 > dps_wpn1 );
CHECK( dps_wpn3 > dps_wpn2 );
}
Expand Down Expand Up @@ -212,3 +220,30 @@ TEST_CASE( "accuracy increases success", "[accuracy][dps]" )
check_accuracy_dps( dummy, survivor, clumsy_sword, normal_sword, balanced_sword );
}
}

TEST_CASE( "rngjoke" )
{
constexpr int trials = 5000;
for( int j = -50; j <= 45; j += 5 ) {
std::vector<bool> results1;
std::vector<bool> results2;
results1.reserve( trials );
results2.reserve( trials );
for( int i = 0; i < trials; i++ ) {
results1.emplace_back( normal_roll( j + 5, 25 ) > 0 );
results2.emplace_back( normal_roll( j, 25 ) > 0 );
}

int successes = std::count_if( results1.begin(), results1.end(), []( bool b ) {
return b == true;
} );
int failures = std::count_if( results2.begin(), results2.end(), []( bool b ) {
return b == true;
} );

std::cout << successes << " > " << failures << "\t// " << j + 5 << " vs " << j << std::endl;
REQUIRE( successes > failures );
results1.clear();
results2.clear();
}
}

0 comments on commit 72770fb

Please sign in to comment.