Let's say you have the following line of code:
var _result = long.Parse(age);| public static int calculateDamageForDice(Character atk, Character def, int dice) | |
| { | |
| boolean hits = def.getArmorClass() < atk.getForce() + dice; | |
| if (hits && dice != 1) | |
| { | |
| int modifier = dice == 20 ? 2 : 1; | |
| return atk.getWeaponDamage() * modifier; | |
| } | |
| else | |
| { |
| import org.approvaltests.combinations.CombinationApprovals | |
| import org.junit.jupiter.api.Test | |
| import org.lambda.functions.Function2 | |
| class InlineTest { | |
| @Test | |
| internal fun testInline() { | |
| val numbers = arrayOf(10, 20, 30, 40, 50) | |
| CombinationApprovals.verifyAllCombinations(Combine(), numbers, numbers) | |
| } |
| public class ProgrammableReporter : IEnvironmentAwareReporter | |
| { | |
| public static IEnvironmentAwareReporter PassTo { get; set; } | |
| public void Report(string approved, string received) | |
| { | |
| PassTo.Report(approved, received); | |
| } |
Let's say you have the following line of code:
var _result = long.Parse(age);| @Test | |
| public void testAddManyToArray() throws Exception | |
| { | |
| Integer[] numbers = {1, 2, 3}; | |
| numbers = ArrayUtils.addToArray(numbers, 4, 5, 6); | |
| Integer[] resulting = {1, 2, 3, 4, 5, 6}; | |
| assertArrayEquals(resulting, numbers); | |
| } |
| #include "catch.hpp" | |
| #include <iostream> | |
| class BaseStructure | |
| { | |
| public: | |
| void(*print)(); | |
| }; | |
| class One |
| from unittest import TestCase | |
| class FizzBuzz(object): | |
| @classmethod | |
| def convert(cls, param): | |
| if (param % 3 == 0 and param % 5 ==0): | |
| return str("FizzBuzz") | |
| if (param % 3 == 0): | |
| return str("Fizz") |
| from unittest import TestCase | |
| def fizzbuzz(i): | |
| #FIZZ when number 3 | |
| if i % 3 == 0 and i % 5 == 0: | |
| return "FIZZBUZZ" | |
| if i % 3 == 0: | |
| return "FIZZ" | |
| if i % 5 == 0: |
| from unittest import TestCase | |
| def fizzbuzz(number): | |
| if number%15 ==0: | |
| return "fizzbuzz" | |
| if number %5 ==0: | |
| return "buzz" | |
| if number %3 ==0: | |
| return "fizz" |