等价类划分

划分等价类:

编号

有效等价类

编号

无效等价类

0

长度1-6

2

长度0

1

字符0-9a-zA-Z

3

长度>=7

 

4

0-9a-zA-Z之外字符

 

 

测试用例:

编号

测试用例

期待输出

实际输出

0

aA01

正确

正确

1

Null

请正确输入

请正确输入

2

aabbccdd

请正确输入

请正确输入

3

abc

请正确输入

请正确输入

 

0

 

1

 

 

2:

 

3:

 

代码(javafx):

package softwareTest;

import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.TextField;
import javafx.scene.layout.AnchorPane;
import javafx.scene.text.Text;
import javafx.stage.Stage;

public class Lueluelue extends Application{
    public static void main(String[] args) {
        Application.launch(args);
    }

    public void start(final Stage stage) throws Exception {
        stage.setTitle("testing");
        final AnchorPane root = new AnchorPane();
        
        final TextField input = new TextField();
        final Button button = new Button("click");
        final Text text1 = new Text("请正确输入");
        final Text text2 = new Text("正确");
        button.setOnAction(new EventHandler<ActionEvent>(){
            public void handle(ActionEvent arg0){
                String string = input.getText();
                char [] str = string.toCharArray();
                if(str.length>0 && str.length<7){
                    int i = 0;
                    for(i = 0 ; i < str.length ; i ++){
                        if((str[i]>='0' && str[i]<='9') ||
                           (str[i]>='a' && str[i]<='z') ||
                           (str[i]>='A' && str[i]<='Z')){
                            continue;
                        }
                        else{
                            AnchorPane.setTopAnchor(text1,(double) 140);
                            root.getChildren().addAll(text1);
                            stage.show();
                        }        
                    }
                    if(i == str.length){
                        AnchorPane.setTopAnchor(text2,(double) 140);
                        root.getChildren().addAll(text2);
                        stage.show();
                    }
                }
                else{
                    AnchorPane.setTopAnchor(text1,(double) 140);
                    root.getChildren().addAll(text1);
                    stage.show();
                }    
            }
        });
        
        AnchorPane.setTopAnchor(input,(double) 60);
        AnchorPane.setTopAnchor(button,(double) 100);
        
        root.getChildren().addAll(input,button);
        stage.setScene(new Scene(root,200,200));
        stage.show();
    }
    
    
}

 么么哒

转载于:https://www.cnblogs.com/cassiecassie/p/4357783.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值