Skip to content

Instantly share code, notes, and snippets.

@MinCha
Last active September 4, 2016 12:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MinCha/f6b80f3d8e4a3c76102f17ee9efdb820 to your computer and use it in GitHub Desktop.
Save MinCha/f6b80f3d8e4a3c76102f17ee9efdb820 to your computer and use it in GitHub Desktop.
아이템/아이템 Correlation 테스트케이스
class CounterItemCorrelationTest extends UnitTest {
@Test
def apToAntiAdHp() = {
val a = aSomeItem(magicalOffense = 70)
val b = aSomeItem(hp = 500, physicalDefense = 50)
assert(CounterItemCorrelation.compute(a, b) == 0.33)
}
@Test
def apToAntiAd() = {
val a = aSomeItem(magicalOffense = 70)
val b = aSomeItem(physicalDefense = 100)
assert(CounterItemCorrelation.compute(a, b) == 0)
}
@Test
def apToHp() = {
val a = aSomeItem(magicalOffense = 70)
val b = aSomeItem(hp = 800)
assert(CounterItemCorrelation.compute(a, b) == 0.5)
}
@Test
def apToAntiApHp() = {
val a = aSomeItem(magicalOffense = 120)
val b = aSomeItem(hp = 500, magicalDefense = 50)
assert(CounterItemCorrelation.compute(a, b) == 0.67)
}
@Test
def apToAd() = {
val a = aSomeItem(magicalOffense = 120)
val b = aSomeItem(physicalOffense = 80)
assert(CounterItemCorrelation.compute(a, b) == 1)
assert(CounterItemCorrelation.compute(b, a) == 1)
}
@Test
def apAntiApToAp() = {
val a = aSomeItem(magicalOffense = 70, magicalDefense = 50)
val b = aSomeItem(magicalOffense = 120)
assert(CounterItemCorrelation.compute(a, b) == 1)
}
@Test
def adAntiApToAp() = {
val a = aSomeItem(physicalOffense = 60, magicalDefense = 50)
val b = aSomeItem(magicalOffense = 50)
assert(CounterItemCorrelation.compute(b, a) == 1)
}
@Test
def adToAd() = {
val a = aSomeItem(physicalOffense = 60)
val b = aSomeItem(physicalOffense = 80)
assert(CounterItemCorrelation.compute(a, b) == 1)
}
@Test
def adToAntiAd() = {
val a = aSomeItem(physicalOffense = 60)
val b = aSomeItem(physicalDefense = 100)
assert(CounterItemCorrelation.compute(a, b) == 1)
}
@Test
def adToAp() = {
val a = aSomeItem(physicalOffense = 60)
val b = aSomeItem(magicalOffense = 100)
assert(CounterItemCorrelation.compute(a, b) == 1)
}
@Test
def hpToAntiAd() = {
val a = aSomeItem(hp = 500)
val b = aSomeItem(physicalDefense = 100, hp = 500)
assert(CounterItemCorrelation.compute(a, b) == 1)
}
@Test
def antiAdToAntiAd() = {
val a = aSomeItem(physicalDefense = 100)
val b = aSomeItem(physicalDefense = 100)
assert(CounterItemCorrelation.compute(a, b) == 1)
}
@Test
def antiAdToAntiAdAntiAp() = {
val a = aSomeItem(physicalDefense = 100)
val b = aSomeItem(physicalDefense = 60, magicalDefense = 60)
assert(CounterItemCorrelation.compute(a, b) == 1)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment