zoukankan      html  css  js  c++  java
  • 软工作业PSP与单元测试训练

    (一)任务说明

         实现模块判断传入的电子邮箱账号的正确性。

    (二)实现要求

        (1)实现功能模块:通过正则表达式进行简单的判断。

            (2)针对实现模块编写对应单元测试代码:

     1 /*
     2  * To change this license header, choose License Headers in Project Properties.
     3  * To change this template file, choose Tools | Templates
     4  * and open the template in the editor.
     5  */
     6 package emailcheck;
     7 
     8 import java.util.Scanner;
     9 import java.util.regex.Pattern;
    10 
    11 /**
    12  *
    13  * @author EvanPatrick
    14  */
    15 public class EmailCheck {
    16     public  static void main(String arg[]) {
    17         Scanner str=new Scanner(System.in);
    18         String email = str.nextLine(); 
    19            while(true)
    20           {
    21           
    22            if (EmailCheck.checkEmail(email))
    23            {   
    24                 System.out.println(email+"is legal Email address!");
    25                 break;
    26            }
    27            else
    28            {
    29                 System.out.println(email+"is illegal Email address!");
    30                 break;
    31            }
    32           }
    33        } 
    34      public static boolean checkEmail(String email) {     
    35             String pattern= "\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*";  
    36             return Pattern.matches(pattern, email);     
    37         }       
    38 }

    测试结果:

            (3)按PSP流程进行工作量估算,填写任务清单工作量估算表。

  • 相关阅读:
    Scrapy的安装和基本使用方法
    使用BERT词向量
    主动学习方法实践:让模型变“主动”
    WSAI2020
    mac电脑的图片存储的位置
    问答系统-不能直接根据问题寻找答案?
    谷歌飞马PEGASUS
    通过强化学习协作多代理对话模型训练
    学习笔记(55)- 深度学习工具及平台
    学习笔记(54)- NLU
  • 原文地址:https://www.cnblogs.com/evanpatrick/p/8594003.html
Copyright © 2011-2022 走看看