Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Get price test
package regex.com;
import static org.junit.jupiter.api.Assertions.assertEquals;
import org.junit.jupiter.api.Test;
public class RegexTest{
public static void main(String[] args) {
RegexTest.test_all();
}
@Test
private static void test_all() {
assertEquals(Regex.toPrice("1円"),"not found price");
assertEquals(Regex.toPrice("10円"),"10");
assertEquals(Regex.toPrice("100円"),"100");
assertEquals(Regex.toPrice("¥1"),"not found price");
assertEquals(Regex.toPrice("¥10"),"10");
assertEquals(Regex.toPrice("¥100"),"100");
assertEquals(Regex.toPrice("¥1円"),"not found price");
assertEquals(Regex.toPrice("¥10円"),"10");
assertEquals(Regex.toPrice("¥100円"),"100");
assertEquals(Regex.toPrice("1USD"),"not found price");
assertEquals(Regex.toPrice("1.00USD"),"1.00");
assertEquals(Regex.toPrice("¥4,447.43最後の1点"),"4447.43");
assertEquals(Regex.toPrice("¥447.43最後の1点"),"447.43");
assertEquals(Regex.toPrice("¥4,447.43残り10点"),"4447.43");
assertEquals(Regex.toPrice("¥,447.43最後の1点"),"447.43");
assertEquals(Regex.toPrice("4US¥4,447最後の1点"),"4447");
assertEquals(Regex.toPrice("4US4,447.43最後の1点"),"4447.43");
assertEquals(Regex.toPrice("4US¥4,447.43最後の1点"),"4447.43");
assertEquals(Regex.toPrice("4UK£4,447最後の1点"),"4447");
assertEquals(Regex.toPrice("4US$4,447最後の1点"),"4447");
assertEquals(Regex.toPrice("4US4,447$最後の1点"),"4447");
assertEquals(Regex.toPrice("10US¥4,447.43最後の1点"),"10");//not support
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.