• 等价类划分


    划分等价类:

    编号

    有效等价类

    编号

    无效等价类

    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();
        }
        
        
    }

     么么哒

  • 相关阅读:
    Polly
    ELK
    Python基础三(选择,循环)
    Python基础二(输入与输出)
    Python关键字
    Python基础一(基本类型和运算符)
    Python发展史
    在虚拟机(vmware)上安装CentOS
    centos7联网
    Hashmap的实现
  • 原文地址:https://www.cnblogs.com/cassiecassie/p/4357783.html
Copyright © 2020-2023  润新知