Answer the question
In order to leave comments, you need to log in
Codewars Tests pass, but not when submitting, what's the problem?
I write code
using System;
using System.Text.RegularExpressions;
public class Kata
{
public static string GoodVsEvil(string good, string evil)
{
string shap = @"\s";
string[] _good = (new Regex(shap)).Split(good);
string[] _evil = (new Regex(shap)).Split(evil);
int power_good = 0;
foreach (string s in _good)
{
power_good += Convert.ToInt32(s);
}
int power_evil = 0;
foreach (string s in _evil)
{
power_evil += System.Convert.ToInt32(s);
}
if (power_good > power_evil)
{ return "Battle Result: Good triumphs over Evil"; }
else
if (power_good < power_evil)
{ return "Battle Result: Evil eradicates all trace of Good"; }
return "Battle Result: No victor on this battle field";
}
}
using System;
using NUnit.Framework;
[TestFixture]
public class GoodVsEvil
{
[Test]
public static void EvilShouldWin()
{
Assert.AreEqual("Battle Result: Evil eradicates all trace of Good", Kata.GoodVsEvil("1 1 1 1 1 1", "1 1 1 1 1 1 1"));
}
[Test]
public static void GoodShouldTriumph()
{
Assert.AreEqual("Battle Result: Good triumphs over Evil", Kata.GoodVsEvil("0 0 0 0 0 10", "0 1 1 1 1 0 0"));
}
[Test]
public static void ShouldBeATie()
{
Assert.AreEqual("Battle Result: No victor on this battle field", Kata.GoodVsEvil("1 0 0 0 0 0", "1 0 0 0 0 0 0"));
}
}
Answer the question
In order to leave comments, you need to log in
These are the tests available to you.
Still, it seems like, there is an additional set of tests that are not visible to you.
See logs. there is often a hint to the test.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question