gitlab.com/evatix-go/core@v1.3.55/tests/testwrappers/corevalidatortestwrappers/TextValidatorTestCases.go (about)

     1  package corevalidatortestwrappers
     2  
     3  import (
     4  	"gitlab.com/evatix-go/core/corevalidator"
     5  	"gitlab.com/evatix-go/core/enums/stringcompareas"
     6  )
     7  
     8  var TextValidatorsTestCases = []TextValidatorsWrapper{
     9  	{
    10  		Header: "Comparing all flag to false, and comparing equal.",
    11  		ComparingLines: []string{
    12  			"alim      alim 2 alim 4",
    13  		},
    14  		Validators: corevalidator.TextValidators{
    15  			Items: []corevalidator.TextValidator{
    16  				{
    17  					Search:   "   alim      alim 2 alim 3                 ",
    18  					SearchAs: stringcompareas.Equal,
    19  					ValidatorCoreCondition: corevalidator.ValidatorCoreCondition{
    20  						IsTrimCompare:        false,
    21  						IsUniqueWordOnly:     false,
    22  						IsNonEmptyWhitespace: false,
    23  						IsSortStringsBySpace: false,
    24  					},
    25  				},
    26  			},
    27  		},
    28  		IsSkipOnContentsEmpty: false,
    29  		IsCaseSensitive:       true,
    30  		ExpectationLines: []string{
    31  			"0 )\t  Expectation failed: Using CompareMethod `\"Equal\"`, Line Index: 0",
    32  			"     Content-Processed:`\"alim      alim 2 alim 4\"`",
    33  			"  SearchTerm-Processed:`\"   alim      alim 2 alim 3                 \"`",
    34  			"            Additional:`\"Search Input: [`   alim      alim 2 alim 3                 `]," +
    35  				" CompareMethod: [`Equal`], " +
    36  				"IsTrimCompare: [`false`], " +
    37  				"IsSplitByWhitespace: [`false`], " +
    38  				"IsUniqueWordOnly: [`false`], " +
    39  				"IsNonEmptyWhitespace: [`false`], " +
    40  				"IsSortStringsBySpace: [`false`]\"`",
    41  		},
    42  	},
    43  	{
    44  		Header: "Comparing all flag to false, and comparing equal.",
    45  		ComparingLines: []string{
    46  			"   alim      alim 2 alim 3                 ",
    47  		},
    48  		Validators: corevalidator.TextValidators{
    49  			Items: []corevalidator.TextValidator{
    50  				{
    51  					Search:   "   alim      alim 2 alim 3                 ",
    52  					SearchAs: stringcompareas.Equal,
    53  				},
    54  			},
    55  		},
    56  		IsSkipOnContentsEmpty: false,
    57  		IsCaseSensitive:       true,
    58  		ExpectationLines:      []string{},
    59  	},
    60  	{
    61  		Header: "Trim compare spaced same text should not give an error.",
    62  		ComparingLines: []string{
    63  			"alim      alim 2 alim 3",
    64  		},
    65  		Validators: corevalidator.TextValidators{
    66  			Items: []corevalidator.TextValidator{
    67  				{
    68  					Search: "   alim      alim 2 alim 3                 ",
    69  					ValidatorCoreCondition: corevalidator.ValidatorCoreCondition{
    70  						IsTrimCompare:        true,
    71  						IsUniqueWordOnly:     false,
    72  						IsNonEmptyWhitespace: false,
    73  						IsSortStringsBySpace: false,
    74  					},
    75  					SearchAs: stringcompareas.Equal,
    76  				},
    77  			},
    78  		},
    79  		IsSkipOnContentsEmpty: false,
    80  		IsCaseSensitive:       true,
    81  		ExpectationLines:      []string{},
    82  	},
    83  	{
    84  		Header: "IsTrimCompare with IsNonEmptyWhitespace true should should match the text and no error",
    85  		ComparingLines: []string{
    86  			"alim alim 2 alim 3",
    87  		},
    88  		Validators: corevalidator.TextValidators{
    89  			Items: []corevalidator.TextValidator{
    90  				{
    91  					Search: "   alim      alim 2 alim 3                 ",
    92  					ValidatorCoreCondition: corevalidator.ValidatorCoreCondition{
    93  						IsTrimCompare:        true,
    94  						IsUniqueWordOnly:     false,
    95  						IsNonEmptyWhitespace: true,
    96  						IsSortStringsBySpace: false,
    97  					},
    98  					SearchAs: stringcompareas.Equal,
    99  				},
   100  			},
   101  		},
   102  		IsSkipOnContentsEmpty: false,
   103  		IsCaseSensitive:       true,
   104  		ExpectationLines:      []string{},
   105  	},
   106  	{
   107  		Header: "IsTrimCompare with IsNonEmptyWhitespace true different text and multiple search should give 2 errors",
   108  		ComparingLines: []string{
   109  			"alim alim 2 alim 4",
   110  			"alim alim 2 alim 3",
   111  			"alim alim 2 alim 5",
   112  		},
   113  		Validators: corevalidator.TextValidators{
   114  			Items: []corevalidator.TextValidator{
   115  				{
   116  					Search: "   alim      alim 2 alim 3                 ",
   117  					ValidatorCoreCondition: corevalidator.ValidatorCoreCondition{
   118  						IsTrimCompare:        true,
   119  						IsUniqueWordOnly:     false,
   120  						IsNonEmptyWhitespace: true,
   121  						IsSortStringsBySpace: false,
   122  					},
   123  					SearchAs: stringcompareas.Equal,
   124  				},
   125  			},
   126  		},
   127  		IsSkipOnContentsEmpty: false,
   128  		IsCaseSensitive:       true,
   129  		ExpectationLines: []string{
   130  			"0 )\t  Expectation failed: Using CompareMethod `\"Equal\"`, Line Index: 0",
   131  			"     Content-Processed:`\"alim alim 2 alim 4\"`",
   132  			"  SearchTerm-Processed:`\"alim alim 2 alim 3\"`",
   133  			"            Additional:`\"Search Input: [`   alim      alim 2 alim 3                 `], " +
   134  				"CompareMethod: [`Equal`], " +
   135  				"IsTrimCompare: [`true`], " +
   136  				"IsSplitByWhitespace: [`true`], " +
   137  				"IsUniqueWordOnly: [`false`], " +
   138  				"IsNonEmptyWhitespace: [`true`], " +
   139  				"IsSortStringsBySpace: [`false`]\"`",
   140  			"0 )\t  Expectation failed: Using CompareMethod `\"Equal\"`, Line Index: 2",
   141  			"     Content-Processed:`\"alim alim 2 alim 5\"`",
   142  			"  SearchTerm-Processed:`\"alim alim 2 alim 3\"`",
   143  			"            Additional:`\"Search Input: [`   alim      alim 2 alim 3                 `], " +
   144  				"CompareMethod: [`Equal`], " +
   145  				"IsTrimCompare: [`true`], " +
   146  				"IsSplitByWhitespace: [`true`], " +
   147  				"IsUniqueWordOnly: [`false`], " +
   148  				"IsNonEmptyWhitespace: [`true`], " +
   149  				"IsSortStringsBySpace: [`false`]\"`",
   150  		},
   151  	},
   152  	{
   153  		Header: "IsTrimCompare, IsSortStringsBySpace with IsNonEmptyWhitespace true " +
   154  			"different text and multiple search should give 2 errors",
   155  		ComparingLines: []string{
   156  			"alim alim 2 alim 4",
   157  			"alim alim 2 alim 3",
   158  			"alim alim 2 alim 5",
   159  		},
   160  		Validators: corevalidator.TextValidators{
   161  			Items: []corevalidator.TextValidator{
   162  				{
   163  					Search: "   alim      3 alim 2 alim                 ",
   164  					ValidatorCoreCondition: corevalidator.ValidatorCoreCondition{
   165  						IsTrimCompare:        true,
   166  						IsUniqueWordOnly:     false,
   167  						IsNonEmptyWhitespace: true,
   168  						IsSortStringsBySpace: true,
   169  					},
   170  					SearchAs: stringcompareas.Equal,
   171  				},
   172  			},
   173  		},
   174  		IsSkipOnContentsEmpty: false,
   175  		IsCaseSensitive:       true,
   176  		ExpectationLines: []string{
   177  			"0 )\t  Expectation failed: Using CompareMethod `\"Equal\"`, Line Index: 0",
   178  			"     Content-Processed:`\"2 4 alim alim alim\"`",
   179  			"  SearchTerm-Processed:`\"2 3 alim alim alim\"`",
   180  			"            Additional:`\"Search Input: [`   alim      3 alim 2 alim                 `], " +
   181  				"CompareMethod: [`Equal`], " +
   182  				"IsTrimCompare: [`true`], " +
   183  				"IsSplitByWhitespace: [`true`], " +
   184  				"IsUniqueWordOnly: [`false`], " +
   185  				"IsNonEmptyWhitespace: [`true`], " +
   186  				"IsSortStringsBySpace: [`true`]\"`",
   187  			"0 )\t  Expectation failed: Using CompareMethod `\"Equal\"`, Line Index: 2",
   188  			"     Content-Processed:`\"2 5 alim alim alim\"`",
   189  			"  SearchTerm-Processed:`\"2 3 alim alim alim\"`",
   190  			"            Additional:`\"Search Input: [`   alim      3 alim 2 alim                 `], " +
   191  				"CompareMethod: [`Equal`], " +
   192  				"IsTrimCompare: [`true`], " +
   193  				"IsSplitByWhitespace: [`true`], " +
   194  				"IsUniqueWordOnly: [`false`], " +
   195  				"IsNonEmptyWhitespace: [`true`], " +
   196  				"IsSortStringsBySpace: [`true`]\"`",
   197  		},
   198  	},
   199  	{
   200  		Header: "All flags true different text and multiple search should give 2 errors",
   201  		ComparingLines: []string{
   202  			"alim alim 2 alim 4",
   203  			"alim alim 2 alim 3",
   204  			"alim alim 2 alim 5",
   205  		},
   206  		Validators: corevalidator.TextValidators{
   207  			Items: []corevalidator.TextValidator{
   208  				{
   209  					Search: "   alim      alim 2 alim 3                 ",
   210  					ValidatorCoreCondition: corevalidator.ValidatorCoreCondition{
   211  						IsTrimCompare:        true,
   212  						IsUniqueWordOnly:     true,
   213  						IsNonEmptyWhitespace: true,
   214  						IsSortStringsBySpace: true,
   215  					},
   216  					SearchAs: stringcompareas.Equal,
   217  				},
   218  			},
   219  		},
   220  		IsSkipOnContentsEmpty: false,
   221  		IsCaseSensitive:       true,
   222  		ExpectationLines: []string{
   223  			"0 )\t  Expectation failed: Using CompareMethod `\"Equal\"`, Line Index: 0",
   224  			"     Content-Processed:`\"2 4 alim\"`",
   225  			"  SearchTerm-Processed:`\"2 3 alim\"`",
   226  			"            Additional:`\"Search Input: [`   alim      alim 2 alim 3                 `], " +
   227  				"CompareMethod: [`Equal`], " +
   228  				"IsTrimCompare: [`true`], " +
   229  				"IsSplitByWhitespace: [`true`], " +
   230  				"IsUniqueWordOnly: [`true`], " +
   231  				"IsNonEmptyWhitespace: [`true`], " +
   232  				"IsSortStringsBySpace: [`true`]\"`",
   233  			"0 )\t  Expectation failed: Using CompareMethod `\"Equal\"`, Line Index: 2",
   234  			"     Content-Processed:`\"2 5 alim\"`",
   235  			"  SearchTerm-Processed:`\"2 3 alim\"`",
   236  			"            Additional:`\"Search Input: [`   alim      alim 2 alim 3                 `], " +
   237  				"CompareMethod: [`Equal`], " +
   238  				"IsTrimCompare: [`true`], " +
   239  				"IsSplitByWhitespace: [`true`], " +
   240  				"IsUniqueWordOnly: [`true`], " +
   241  				"IsNonEmptyWhitespace: [`true`], " +
   242  				"IsSortStringsBySpace: [`true`]\"`",
   243  		},
   244  	},
   245  	{
   246  		Header: "All flags true different text and multiple search NOT " +
   247  			"equal method gives only one error for equal one.",
   248  		ComparingLines: []string{
   249  			"alim alim 2 alim 4",
   250  			"alim alim 2 alim 3",
   251  			"alim alim 2 alim 5",
   252  		},
   253  		Validators: corevalidator.TextValidators{
   254  			Items: []corevalidator.TextValidator{
   255  				{
   256  					Search: "   alim      alim 2 alim 3                 ",
   257  					ValidatorCoreCondition: corevalidator.ValidatorCoreCondition{
   258  						IsTrimCompare:        true,
   259  						IsUniqueWordOnly:     true,
   260  						IsNonEmptyWhitespace: true,
   261  						IsSortStringsBySpace: true,
   262  					},
   263  					SearchAs: stringcompareas.NotEqual,
   264  				},
   265  			},
   266  		},
   267  		IsSkipOnContentsEmpty: false,
   268  		IsCaseSensitive:       true,
   269  		ExpectationLines: []string{
   270  			"0 )\t  Expectation failed: Using CompareMethod `\"NotEqual\"`, Line Index: 1",
   271  			"     Content-Processed:`\"2 3 alim\"`",
   272  			"  SearchTerm-Processed:`\"2 3 alim\"`",
   273  			"            Additional:`\"Search Input: [`   alim      alim 2 alim 3                 `], " +
   274  				"CompareMethod: [`NotEqual`], " +
   275  				"IsTrimCompare: [`true`], " +
   276  				"IsSplitByWhitespace: [`true`], " +
   277  				"IsUniqueWordOnly: [`true`], " +
   278  				"IsNonEmptyWhitespace: [`true`], " +
   279  				"IsSortStringsBySpace: [`true`]\"`",
   280  		},
   281  	},
   282  	{
   283  		Header: "Nonsensitive - All flags true different text and multiple search NOT " +
   284  			"equal method gives only one error for matching one for equal one.",
   285  		ComparingLines: []string{
   286  			"alim alim 2 alim 4",
   287  			"Alim alim 2 Alim 3",
   288  			"alim alim 2 alim 5",
   289  		},
   290  		Validators: corevalidator.TextValidators{
   291  			Items: []corevalidator.TextValidator{
   292  				{
   293  					Search: "   alim      alim 2 alim 3                 ",
   294  					ValidatorCoreCondition: corevalidator.ValidatorCoreCondition{
   295  						IsTrimCompare:        true,
   296  						IsUniqueWordOnly:     true,
   297  						IsNonEmptyWhitespace: true,
   298  						IsSortStringsBySpace: true,
   299  					},
   300  					SearchAs: stringcompareas.NotEqual,
   301  				},
   302  			},
   303  		},
   304  		IsSkipOnContentsEmpty: false,
   305  		IsCaseSensitive:       false,
   306  		ExpectationLines: []string{
   307  			"0 )\t  Expectation failed: Using CompareMethod `\"NotEqual\"`, Line Index: 1",
   308  			"     Content-Processed:`\"2 3 alim\"`",
   309  			"  SearchTerm-Processed:`\"2 3 alim\"`",
   310  			"            Additional:`\"Search Input: [`   alim      alim 2 alim 3                 `], " +
   311  				"CompareMethod: [`NotEqual`], " +
   312  				"IsTrimCompare: [`true`], " +
   313  				"IsSplitByWhitespace: [`true`], " +
   314  				"IsUniqueWordOnly: [`true`], " +
   315  				"IsNonEmptyWhitespace: [`true`], " +
   316  				"IsSortStringsBySpace: [`true`]\"`",
   317  		},
   318  	},
   319  	{
   320  		Header: "Nonsensitive - All flags true different text and multiple search NOT " +
   321  			"equal method gives only one error for matching one for equal one.",
   322  		ComparingLines: []string{
   323  			"Alim alim 2 alim 4",
   324  			"Alim alim 2 Alim 3",
   325  			"alim alim 2 alim 5",
   326  		},
   327  		Validators: corevalidator.TextValidators{
   328  			Items: []corevalidator.TextValidator{
   329  				{
   330  					Search: "   alim      alim 2 alim 3                 ",
   331  					ValidatorCoreCondition: corevalidator.ValidatorCoreCondition{
   332  						IsTrimCompare:        true,
   333  						IsUniqueWordOnly:     true,
   334  						IsNonEmptyWhitespace: true,
   335  						IsSortStringsBySpace: true,
   336  					},
   337  					SearchAs: stringcompareas.NotEqual,
   338  				},
   339  			},
   340  		},
   341  		IsSkipOnContentsEmpty: false,
   342  		IsCaseSensitive:       false,
   343  		ExpectationLines: []string{
   344  			"0 )\t  Expectation failed: Using CompareMethod `\"NotEqual\"`, Line Index: 1",
   345  			"     Content-Processed:`\"2 3 alim\"`",
   346  			"  SearchTerm-Processed:`\"2 3 alim\"`",
   347  			"            Additional:`\"Search Input: [`   alim      alim 2 alim 3                 `], " +
   348  				"CompareMethod: [`NotEqual`], " +
   349  				"IsTrimCompare: [`true`], " +
   350  				"IsSplitByWhitespace: [`true`], " +
   351  				"IsUniqueWordOnly: [`true`], " +
   352  				"IsNonEmptyWhitespace: [`true`], " +
   353  				"IsSortStringsBySpace: [`true`]\"`",
   354  		},
   355  	},
   356  	{
   357  		Header: "Nonsensitive - All flags true different text and multiple search NOT " +
   358  			"equal method gives only one error for matching one for equal one.",
   359  		ComparingLines: []string{
   360  			"Alim alim 2 alim 4",
   361  			"Alim alim 2 Alim 3",
   362  			"alim alim 2 alim 5",
   363  		},
   364  		Validators: corevalidator.TextValidators{
   365  			Items: []corevalidator.TextValidator{
   366  				{
   367  					Search: "   alim      alim 2 Alim 3                 ",
   368  					ValidatorCoreCondition: corevalidator.ValidatorCoreCondition{
   369  						IsTrimCompare:        true,
   370  						IsUniqueWordOnly:     false,
   371  						IsNonEmptyWhitespace: true,
   372  						IsSortStringsBySpace: true,
   373  					},
   374  					SearchAs: stringcompareas.NotEqual,
   375  				},
   376  			},
   377  		},
   378  		IsSkipOnContentsEmpty: false,
   379  		IsCaseSensitive:       false,
   380  		ExpectationLines: []string{
   381  			"0 )\t  Expectation failed: Using CompareMethod `\"NotEqual\"`, Line Index: 1",
   382  			"     Content-Processed:`\"2 3 Alim Alim alim\"`",
   383  			"  SearchTerm-Processed:`\"2 3 Alim alim alim\"`",
   384  			"            Additional:`\"Search Input: [`   alim      alim 2 Alim 3                 `], " +
   385  				"CompareMethod: [`NotEqual`], " +
   386  				"IsTrimCompare: [`true`], " +
   387  				"IsSplitByWhitespace: [`true`], " +
   388  				"IsUniqueWordOnly: [`false`], " +
   389  				"IsNonEmptyWhitespace: [`true`], " +
   390  				"IsSortStringsBySpace: [`true`]\"`",
   391  		},
   392  	},
   393  }