Jonny Borges
Committed by GitHub

Merge pull request #607 from Nipodemos/more_tests

Add more tests for string and num extensions
@@ -32,8 +32,8 @@ class _RxImpl<T> implements RxInterface<T> { @@ -32,8 +32,8 @@ class _RxImpl<T> implements RxInterface<T> {
32 /// 32 ///
33 /// // in your build(BuildContext) { 33 /// // in your build(BuildContext) {
34 /// TextField( 34 /// TextField(
35 - // onChanged: myText,  
36 - // ), 35 + /// onChanged: myText,
  36 + /// ),
37 ///``` 37 ///```
38 T call([T v]) { 38 T call([T v]) {
39 if (v != null) { 39 if (v != null) {
1 import '../regex/get_utils.dart'; 1 import '../regex/get_utils.dart';
2 2
3 extension GetDynamicUtils on dynamic { 3 extension GetDynamicUtils on dynamic {
4 - /// It's This is overloading the IDE's options. Only the most useful and  
5 - /// popular options will stay here.  
6 -  
7 bool get isNull => GetUtils.isNull(this); 4 bool get isNull => GetUtils.isNull(this);
8 5
9 bool get isNullOrBlank => GetUtils.isNullOrBlank(this); 6 bool get isNullOrBlank => GetUtils.isNullOrBlank(this);
@@ -24,8 +24,10 @@ extension GetNumUtils on num { @@ -24,8 +24,10 @@ extension GetNumUtils on num {
24 /// print('currently running callback 1.2sec'); 24 /// print('currently running callback 1.2sec');
25 /// } 25 /// }
26 ///``` 26 ///```
27 - Future delay([VoidCallback callback]) async =>  
28 - Future.delayed(Duration(milliseconds: (this * 1000).round()), callback); 27 + Future delay([VoidCallback callback]) async => Future.delayed(
  28 + Duration(milliseconds: (this * 1000).round()),
  29 + callback,
  30 + );
29 31
30 /// Easy way to make Durations from numbers. 32 /// Easy way to make Durations from numbers.
31 /// 33 ///
@@ -59,9 +59,9 @@ extension GetStringUtils on String { @@ -59,9 +59,9 @@ extension GetStringUtils on String {
59 59
60 bool get isCurrency => GetUtils.isCurrency(this); 60 bool get isCurrency => GetUtils.isCurrency(this);
61 61
62 - bool isCpf(String s) => GetUtils.isCpf(this); 62 + bool get isCpf => GetUtils.isCpf(this);
63 63
64 - bool isCnpj(String s) => GetUtils.isCnpj(this); 64 + bool get isCnpj => GetUtils.isCnpj(this);
65 65
66 bool isCaseInsensitiveContains(String b) => 66 bool isCaseInsensitiveContains(String b) =>
67 GetUtils.isCaseInsensitiveContains(this, b); 67 GetUtils.isCaseInsensitiveContains(this, b);
@@ -69,15 +69,14 @@ extension GetStringUtils on String { @@ -69,15 +69,14 @@ extension GetStringUtils on String {
69 bool isCaseInsensitiveContainsAny(String b) => 69 bool isCaseInsensitiveContainsAny(String b) =>
70 GetUtils.isCaseInsensitiveContainsAny(this, b); 70 GetUtils.isCaseInsensitiveContainsAny(this, b);
71 71
72 - String capitalize(String s, {bool firstOnly = false}) =>  
73 - GetUtils.capitalize(this, firstOnly: firstOnly); 72 + String get capitalize => GetUtils.capitalize(this);
74 73
75 - String capitalizeFirst(String s) => GetUtils.capitalizeFirst(this); 74 + String get capitalizeFirst => GetUtils.capitalizeFirst(this);
76 75
77 - String removeAllWhitespace(String s) => GetUtils.removeAllWhitespace(this); 76 + String get removeAllWhitespace => GetUtils.removeAllWhitespace(this);
78 77
79 - String camelCase(String s) => GetUtils.camelCase(this); 78 + String get camelCase => GetUtils.camelCase(this);
80 79
81 - String numericOnly(String s, {bool firstWordOnly = false}) => 80 + String numericOnly({bool firstWordOnly = false}) =>
82 GetUtils.numericOnly(this, firstWordOnly: firstWordOnly); 81 GetUtils.numericOnly(this, firstWordOnly: firstWordOnly);
83 } 82 }
@@ -159,7 +159,7 @@ class GetUtils { @@ -159,7 +159,7 @@ class GetUtils {
159 r'^(?!0{3}|6{3}|9[0-9]{2})[0-9]{3}-?(?!0{2})[0-9]{2}-?(?!0{4})[0-9]{4}$'); 159 r'^(?!0{3}|6{3}|9[0-9]{2})[0-9]{3}-?(?!0{2})[0-9]{2}-?(?!0{4})[0-9]{4}$');
160 160
161 /// Checks if string is binary. 161 /// Checks if string is binary.
162 - static bool isBinary(String s) => hasMatch(s, r'^[0-1]*$'); 162 + static bool isBinary(String s) => hasMatch(s, r'^[0-1]+$');
163 163
164 /// Checks if string is IPv4. 164 /// Checks if string is IPv4.
165 static bool isIPv4(String s) => 165 static bool isIPv4(String s) =>
@@ -176,9 +176,13 @@ class GetUtils { @@ -176,9 +176,13 @@ class GetUtils {
176 176
177 /// Checks if string is Palindrom. 177 /// Checks if string is Palindrom.
178 static bool isPalindrom(String s) { 178 static bool isPalindrom(String s) {
  179 + final cleanString = s
  180 + .toLowerCase()
  181 + .replaceAll(RegExp(r"\s+"), '')
  182 + .replaceAll(RegExp(r"[^0-9a-zA-Z]+"), "");
179 var isPalindrom = true; 183 var isPalindrom = true;
180 - for (var i = 0; i < s.length; i++) {  
181 - if (s[i] != s[s.length - i - 1]) { 184 + for (var i = 0; i < cleanString.length; i++) {
  185 + if (cleanString[i] != cleanString[cleanString.length - i - 1]) {
182 isPalindrom = false; 186 isPalindrom = false;
183 } 187 }
184 } 188 }
@@ -216,7 +220,7 @@ class GetUtils { @@ -216,7 +220,7 @@ class GetUtils {
216 220
217 /// Checks if string is Currency. 221 /// Checks if string is Currency.
218 static bool isCurrency(String s) => hasMatch(s, 222 static bool isCurrency(String s) => hasMatch(s,
219 - r'^(S?\$|\₩|Rp|\¥|\€|\₹|\₽|fr|R$|R)?[ ]?[-]?([0-9]{1,3}[,.]([0-9]{3}[,.])*[0-9]{3}|[0-9]+)([,.][0-9]{1,2})?( ?(USD?|AUD|NZD|CAD|CHF|GBP|CNY|EUR|JPY|IDR|MXN|NOK|KRW|TRY|INR|RUB|BRL|ZAR|SGD|MYR))?$'); 223 + r'^(S?\$|\₩|Rp|\¥|\€|\₹|\₽|fr|R\$|R)?[ ]?[-]?([0-9]{1,3}[,.]([0-9]{3}[,.])*[0-9]{3}|[0-9]+)([,.][0-9]{1,2})?( ?(USD?|AUD|NZD|CAD|CHF|GBP|CNY|EUR|JPY|IDR|MXN|NOK|KRW|TRY|INR|RUB|BRL|ZAR|SGD|MYR))?$');
220 224
221 /// Checks if length of data is LOWER than maxLength. 225 /// Checks if length of data is LOWER than maxLength.
222 static bool isLengthLowerThan(dynamic s, int maxLength) { 226 static bool isLengthLowerThan(dynamic s, int maxLength) {
@@ -433,18 +437,16 @@ class GetUtils { @@ -433,18 +437,16 @@ class GetUtils {
433 437
434 /// Capitalize each word inside string 438 /// Capitalize each word inside string
435 /// Example: your name => Your Name, your name => Your name 439 /// Example: your name => Your Name, your name => Your name
436 - ///  
437 - /// If First Only is `true`, the only letter get uppercase is the first letter  
438 - static String capitalize(String s, {bool firstOnly = false}) { 440 + static String capitalize(String s) {
439 if (isNullOrBlank(s)) return null; 441 if (isNullOrBlank(s)) return null;
440 - if (firstOnly) return capitalizeFirst(s);  
441 442
442 - var lst = s.split(' ');  
443 - var newStr = '';  
444 - for (var s in lst) {  
445 - newStr += capitalizeFirst(s); 443 + var separatedWords = s.split(' ');
  444 + var result = '';
  445 + for (var word in separatedWords) {
  446 + result += capitalizeFirst(word);
  447 + result += ' ';
446 } 448 }
447 - return newStr; 449 + return result.trim();
448 } 450 }
449 451
450 /// Uppercase first letter inside string and let the others lowercase 452 /// Uppercase first letter inside string and let the others lowercase
@@ -465,7 +467,13 @@ class GetUtils { @@ -465,7 +467,13 @@ class GetUtils {
465 /// Example: your name => yourName 467 /// Example: your name => yourName
466 static String camelCase(String s) { 468 static String camelCase(String s) {
467 if (isNullOrBlank(s)) return null; 469 if (isNullOrBlank(s)) return null;
468 - return s[0].toLowerCase() + removeAllWhitespace(capitalize(s)).substring(1); 470 + var separatedWords = s.split(' ');
  471 + var newString = '';
  472 + for (final word in separatedWords) {
  473 + newString += word[0].toUpperCase() + word.substring(1).toLowerCase();
  474 + }
  475 +
  476 + return newString[0].toLowerCase() + newString.substring(1);
469 } 477 }
470 478
471 /// Extract numeric value of string 479 /// Extract numeric value of string
1 -import 'get_utils.dart';  
2 -  
3 -extension GetStringUtils on String {  
4 - bool get isNum => GetUtils.isNum(this);  
5 -  
6 - bool get isNumericOnly => GetUtils.isNumericOnly(this);  
7 -  
8 - bool get isAlphabetOnly => GetUtils.isAlphabetOnly(this);  
9 -  
10 - bool get isBool => GetUtils.isBool(this);  
11 -  
12 - bool get isVectorFileName => GetUtils.isVector(this);  
13 -  
14 - bool get isImageFileName => GetUtils.isImage(this);  
15 -  
16 - bool get isAudioFileName => GetUtils.isAudio(this);  
17 -  
18 - bool get isVideoFileName => GetUtils.isVideo(this);  
19 -  
20 - bool get isTxtFileName => GetUtils.isTxt(this);  
21 -  
22 - bool get isDocumentFileName => GetUtils.isWord(this);  
23 -  
24 - bool get isExcelFileName => GetUtils.isExcel(this);  
25 -  
26 - bool get isPPTFileName => GetUtils.isPPT(this);  
27 -  
28 - bool get isAPKFileName => GetUtils.isAPK(this);  
29 -  
30 - bool get isPDFFileName => GetUtils.isPDF(this);  
31 -  
32 - bool get isHTMLFileName => GetUtils.isHTML(this);  
33 -  
34 - bool get isURL => GetUtils.isURL(this);  
35 -  
36 - bool get isEmail => GetUtils.isEmail(this);  
37 -  
38 - bool get isPhoneNumber => GetUtils.isPhoneNumber(this);  
39 -  
40 - bool get isDateTime => GetUtils.isDateTime(this);  
41 -  
42 - bool get isMD5 => GetUtils.isMD5(this);  
43 -  
44 - bool get isSHA1 => GetUtils.isSHA1(this);  
45 -  
46 - bool get isSHA256 => GetUtils.isSHA256(this);  
47 -  
48 - bool get isBinary => GetUtils.isBinary(this);  
49 -  
50 - bool get isIPv4 => GetUtils.isIPv4(this);  
51 -  
52 - bool get isIPv6 => GetUtils.isIPv6(this);  
53 -  
54 - bool get isHexadecimal => GetUtils.isHexadecimal(this);  
55 -  
56 - bool get isPalindrom => GetUtils.isPalindrom(this);  
57 -  
58 - bool get isPassport => GetUtils.isPassport(this);  
59 -  
60 - bool get isCurrency => GetUtils.isCurrency(this);  
61 -  
62 - bool isCpf(String s) => GetUtils.isCpf(this);  
63 -  
64 - bool isCnpj(String s) => GetUtils.isCnpj(this);  
65 -  
66 - bool isCaseInsensitiveContains(String b) =>  
67 - GetUtils.isCaseInsensitiveContains(this, b);  
68 -  
69 - bool isCaseInsensitiveContainsAny(String b) =>  
70 - GetUtils.isCaseInsensitiveContainsAny(this, b);  
71 -  
72 - String capitalize(String s, {bool firstOnly = false}) =>  
73 - GetUtils.capitalize(this, firstOnly: firstOnly);  
74 -  
75 - String capitalizeFirst(String s) => GetUtils.capitalizeFirst(this);  
76 -  
77 - String removeAllWhitespace(String s) => GetUtils.removeAllWhitespace(this);  
78 -  
79 - String camelCase(String s) => GetUtils.camelCase(this);  
80 -  
81 - String numericOnly(String s, {bool firstWordOnly = false}) =>  
82 - GetUtils.numericOnly(this, firstWordOnly: firstWordOnly);  
83 -}  
84 -  
85 -extension GetNumUtils on num {  
86 - bool isLowerThan(num b) => GetUtils.isLowerThan(this, b);  
87 -  
88 - bool isGreaterThan(num b) => GetUtils.isGreaterThan(this, b);  
89 -  
90 - bool isEqual(num b) => GetUtils.isEqual(this, b);  
91 -}  
92 -  
93 -extension GetDynamicUtils on dynamic {  
94 - bool get isNull => GetUtils.isNull(this);  
95 -  
96 - bool get isNullOrBlank => GetUtils.isNullOrBlank(this);  
97 -}  
@@ -25,7 +25,7 @@ void main() { @@ -25,7 +25,7 @@ void main() {
25 GetBuilder<Controller>( 25 GetBuilder<Controller>(
26 id: '1', 26 id: '1',
27 didChangeDependencies: (_) { 27 didChangeDependencies: (_) {
28 - print("didChangeDependencies called"); 28 + // print("didChangeDependencies called");
29 }, 29 },
30 builder: (controller) { 30 builder: (controller) {
31 return Text('id ${controller.counter}'); 31 return Text('id ${controller.counter}');
@@ -40,7 +40,7 @@ void main() { @@ -40,7 +40,7 @@ void main() {
40 final count = 0.obs; 40 final count = 0.obs;
41 var result = -1; 41 var result = -1;
42 debounce(count, (_) { 42 debounce(count, (_) {
43 - print(_); 43 + // print(_);
44 result = _ as int; 44 result = _ as int;
45 }, time: Duration(milliseconds: 100)); 45 }, time: Duration(milliseconds: 100));
46 46
@@ -58,7 +58,7 @@ void main() { @@ -58,7 +58,7 @@ void main() {
58 final count = 0.obs; 58 final count = 0.obs;
59 var result = -1; 59 var result = -1;
60 interval(count, (_) { 60 interval(count, (_) {
61 - print(_); 61 + // print(_);
62 result = _ as int; 62 result = _ as int;
63 }, time: Duration(milliseconds: 100)); 63 }, time: Duration(milliseconds: 100));
64 64
1 import 'package:flutter_test/flutter_test.dart'; 1 import 'package:flutter_test/flutter_test.dart';
  2 +import 'package:get/utils.dart';
  3 +
  4 +class TestClass {
  5 + final name = "John";
  6 +}
  7 +
  8 +class EmptyClass {}
2 9
3 void main() { 10 void main() {
4 - test('', () {}); 11 + group('dynamic extensions', () {
  12 + test('var.isNullOrBlank on a string ', () {
  13 + var string = '';
  14 + expect('foo'.isNullOrBlank, equals(false));
  15 + expect(string.isNullOrBlank, equals(true));
  16 + });
  17 + test('var.isNullOrBlank on a int ', () {
  18 + expect(5.isNullOrBlank, equals(false));
  19 + expect(0.isNullOrBlank, equals(false));
  20 + });
  21 +
  22 + test('var.isNullOrBlank on a double ', () {
  23 + expect(5.0.isNullOrBlank, equals(false));
  24 + expect(0.0.isNullOrBlank, equals(false));
  25 + });
  26 +
  27 + test('var.isNullOrBlank on a list ', () {
  28 + var list = ['foo'];
  29 + expect([].isNullOrBlank, equals(true));
  30 + expect(['oi', 'foo'].isNullOrBlank, equals(false));
  31 + expect([{}, {}].isNullOrBlank, equals(false));
  32 + expect(list[0].isNullOrBlank, equals(false));
  33 + });
  34 +
  35 + test('var.isNullOrBlank on a set ', () {
  36 + var halogens = {'fluorine', 'chlorine', 'bromine', 'iodine', 'astatine'};
  37 + expect(<String>{}.isNullOrBlank, equals(true));
  38 + expect({'foo', 'bar'}.isNullOrBlank, equals(false));
  39 + expect(halogens.isNullOrBlank, equals(false));
  40 + });
  41 +
  42 + test('var.isNullOrBlank on a map ', () {
  43 + var map = {"foo": 'bar', "one": "um"};
  44 + expect({}.isNullOrBlank, equals(true));
  45 + expect({"other": "thing"}.isNullOrBlank, equals(false));
  46 + expect({'first': [], 'second': []}.isNullOrBlank, equals(false));
  47 + expect(map["foo"].isNullOrBlank, equals(false));
  48 + expect(map["other"].isNullOrBlank, equals(true));
  49 + });
  50 +
  51 + test('var.isNullOrBlank on a function ', () {
  52 + someFunction({String string, int integer}) {
  53 + expect(string.isNullOrBlank, equals(false));
  54 + expect(integer.isNullOrBlank, equals(true));
  55 + }
  56 +
  57 + someFunction(string: 'some value');
  58 + });
  59 +
  60 + test('var.isNullOrBlank on a class ', () {
  61 + TestClass testClass;
  62 + expect(TestClass().isNullOrBlank, equals(false));
  63 + expect(testClass.isNullOrBlank, equals(true));
  64 + expect(EmptyClass().isNullOrBlank, equals(false));
  65 + });
  66 + });
5 } 67 }
@@ -4,18 +4,42 @@ import 'package:get/utils.dart'; @@ -4,18 +4,42 @@ import 'package:get/utils.dart';
4 void main() { 4 void main() {
5 num x = 5; 5 num x = 5;
6 num y = 7; 6 num y = 7;
7 - test('Test for var.isLowerThan(value)', () {  
8 - expect(x.isLowerThan(y), true);  
9 - expect(y.isLowerThan(x), false);  
10 - });  
11 - test('Test for var.isGreaterThan(value)', () {  
12 - expect(x.isGreaterThan(y), false);  
13 - expect(y.isGreaterThan(x), true);  
14 - });  
15 - test('Test for var.isGreaterThan(value)', () {  
16 - expect(x.isEqual(y), false);  
17 - expect(y.isEqual(x), false);  
18 - expect(x.isEqual(5), true);  
19 - expect(y.isEqual(7), true); 7 + num z = 5;
  8 +
  9 + var doubleX = 2.1;
  10 + var doubleY = 3.1;
  11 + var doubleZ = 5.0;
  12 + var pi = 3.14159265359;
  13 +
  14 + group('num extensions text', () {
  15 + test('var.isLowerThan(value)', () {
  16 + expect(x.isLowerThan(y), true);
  17 + expect(y.isLowerThan(x), false);
  18 + expect(x.isLowerThan(z), false);
  19 + expect(doubleX.isLowerThan(doubleY), true);
  20 + expect(doubleY.isLowerThan(pi), true);
  21 + expect(x.isLowerThan(doubleX), false);
  22 + expect(z.isLowerThan(doubleZ), false);
  23 + });
  24 + test('var.isGreaterThan(value)', () {
  25 + expect(x.isGreaterThan(y), false);
  26 + expect(y.isGreaterThan(x), true);
  27 + expect(x.isGreaterThan(z), false);
  28 + expect(doubleX.isGreaterThan(doubleY), false);
  29 + expect(doubleY.isGreaterThan(pi), false);
  30 + expect(pi.isGreaterThan(3.14159265359), false);
  31 + expect(y.isGreaterThan(doubleY), true);
  32 + expect(z.isGreaterThan(doubleZ), false);
  33 + });
  34 + test('var.isEqual(value)', () {
  35 + expect(x.isEqual(y), false);
  36 + expect(y.isEqual(x), false);
  37 + expect(x.isEqual(5), true);
  38 + expect(y.isEqual(7), true);
  39 + expect(doubleX.isEqual(doubleY), false);
  40 + expect(doubleY.isEqual(pi), false);
  41 + expect(pi.isEqual(3.14159265359), true);
  42 + expect(z.isEqual(doubleZ), true);
  43 + });
20 }); 44 });
21 } 45 }
@@ -2,18 +2,714 @@ import 'package:flutter_test/flutter_test.dart'; @@ -2,18 +2,714 @@ import 'package:flutter_test/flutter_test.dart';
2 import 'package:get/utils.dart'; 2 import 'package:get/utils.dart';
3 3
4 void main() { 4 void main() {
5 - group('Test group for extension: isNullOrBlank', () {  
6 - String testString;  
7 - test('String extension: isNullOrBlank', () {  
8 - expect(testString.isNullOrBlank, equals(true));  
9 - });  
10 - test('String extension: isNullOrBlank', () {  
11 - testString = 'Not null anymore';  
12 - expect(testString.isNullOrBlank, equals(false));  
13 - });  
14 - test('String extension: isNullOrBlank', () {  
15 - testString = '';  
16 - expect(testString.isNullOrBlank, equals(true)); 5 + group('String extensions', () {
  6 + final text = "oi";
  7 + final digit = "5";
  8 + final specialCaracters = "#\$!%@";
  9 + final alphaNumeric = "123asd";
  10 + final numbers = "123";
  11 + final letters = "foo";
  12 + String notInitializedVar;
  13 +
  14 + test('var.isNum', () {
  15 + expect(digit.isNum, true);
  16 + expect(text.isNum, false);
  17 + });
  18 +
  19 + test('var.isNumericOnly', () {
  20 + expect(numbers.isNumericOnly, true);
  21 + expect(letters.isNumericOnly, false);
  22 + expect(specialCaracters.isNumericOnly, false);
  23 + expect(alphaNumeric.isNumericOnly, false);
  24 + });
  25 +
  26 + test('var.isAlphabetOnly', () {
  27 + expect(alphaNumeric.isAlphabetOnly, false);
  28 + expect(numbers.isAlphabetOnly, false);
  29 + expect(letters.isAlphabetOnly, true);
  30 + });
  31 +
  32 + test('var.isBool', () {
  33 + final trueString = 'true';
  34 + expect(notInitializedVar.isBool, false);
  35 + expect(letters.isBool, false);
  36 + expect(trueString.isBool, true);
  37 + });
  38 +
  39 + test('var.isVectorFileName', () {
  40 + final path = "logo.svg";
  41 + final fullPath = "C:/Users/Getx/Documents/logo.svg";
  42 + expect(path.isVectorFileName, true);
  43 + expect(fullPath.isVectorFileName, true);
  44 + expect(alphaNumeric.isVectorFileName, false);
  45 + });
  46 +
  47 + test('var.isImageFileName', () {
  48 + final jpgPath = "logo.jpg";
  49 + final jpegPath = "logo.jpeg";
  50 + final pngPath = "logo.png";
  51 + final gifPath = "logo.gif";
  52 + final bmpPath = "logo.bmp";
  53 + final svgPath = "logo.svg";
  54 +
  55 + expect(jpgPath.isImageFileName, true);
  56 + expect(jpegPath.isImageFileName, true);
  57 + expect(pngPath.isImageFileName, true);
  58 + expect(gifPath.isImageFileName, true);
  59 + expect(bmpPath.isImageFileName, true);
  60 + expect(svgPath.isImageFileName, false);
  61 + });
  62 +
  63 + test('var.isAudioFileName', () {
  64 + final mp3Path = "logo.mp3";
  65 + final wavPath = "logo.wav";
  66 + final wmaPath = "logo.wma";
  67 + final amrPath = "logo.amr";
  68 + final oggPath = "logo.ogg";
  69 + final svgPath = "logo.svg";
  70 +
  71 + expect(mp3Path.isAudioFileName, true);
  72 + expect(wavPath.isAudioFileName, true);
  73 + expect(wmaPath.isAudioFileName, true);
  74 + expect(amrPath.isAudioFileName, true);
  75 + expect(oggPath.isAudioFileName, true);
  76 + expect(svgPath.isAudioFileName, false);
  77 + });
  78 +
  79 + test('var.isVideoFileName', () {
  80 + final mp4Path = "logo.mp4";
  81 + final aviPath = "logo.avi";
  82 + final wmvPath = "logo.wmv";
  83 + final rmvbPath = "logo.rmvb";
  84 + final mpgPath = "logo.mpg";
  85 + final mpegPath = "logo.mpeg";
  86 + final threegpPath = "logo.3gp";
  87 + final svgPath = "logo.svg";
  88 +
  89 + expect(mp4Path.isVideoFileName, true);
  90 + expect(aviPath.isVideoFileName, true);
  91 + expect(wmvPath.isVideoFileName, true);
  92 + expect(rmvbPath.isVideoFileName, true);
  93 + expect(mpgPath.isVideoFileName, true);
  94 + expect(mpegPath.isVideoFileName, true);
  95 + expect(threegpPath.isVideoFileName, true);
  96 + expect(svgPath.isAudioFileName, false);
  97 + });
  98 +
  99 + test('var.isTxtFileName', () {
  100 + const txtPath = 'file.txt';
  101 + expect(txtPath.isTxtFileName, true);
  102 + expect(alphaNumeric.isTxtFileName, false);
  103 + });
  104 +
  105 + test('var.isDocumentFileName', () {
  106 + final docPath = "file.doc";
  107 + final docxPath = "file.docx";
  108 +
  109 + expect(docPath.isDocumentFileName, true);
  110 + expect(docxPath.isDocumentFileName, true);
  111 + expect(alphaNumeric.isDocumentFileName, false);
  112 + });
  113 +
  114 + test('var.isExcelFileName', () {
  115 + final xlsPath = "file.xls";
  116 + final xlsxPath = "file.xlsx";
  117 +
  118 + expect(xlsPath.isExcelFileName, true);
  119 + expect(xlsxPath.isExcelFileName, true);
  120 + expect(alphaNumeric.isExcelFileName, false);
  121 + });
  122 +
  123 + test('var.isPPTFileName', () {
  124 + final pptPath = "file.ppt";
  125 + final pptxPath = "file.pptx";
  126 +
  127 + expect(pptPath.isPPTFileName, true);
  128 + expect(pptxPath.isPPTFileName, true);
  129 + expect(alphaNumeric.isPPTFileName, false);
  130 + });
  131 +
  132 + test('var.isAPKFileName', () {
  133 + final apkPath = "file.apk";
  134 +
  135 + expect(apkPath.isAPKFileName, true);
  136 + expect(alphaNumeric.isAPKFileName, false);
  137 + });
  138 +
  139 + test('var.isPDFFileName', () {
  140 + final pdfPath = "file.pdf";
  141 +
  142 + expect(pdfPath.isPDFFileName, true);
  143 + expect(alphaNumeric.isPDFFileName, false);
  144 + });
  145 + test('var.isHTMLFileName', () {
  146 + final htmlPath = "file.html";
  147 +
  148 + expect(htmlPath.isHTMLFileName, true);
  149 + expect(alphaNumeric.isHTMLFileName, false);
  150 + });
  151 + test('var.isURL', () {
  152 + // Url's generated in https://www.randomlists.com/urls
  153 + final urls = [
  154 + 'http://www.example.com/aunt/babies.aspx#act',
  155 + 'http://adjustment.example.com/bedroom/animal.htm',
  156 + 'http://blade.example.com/arch/basketball',
  157 + 'https://www.example.com/air/advice.php',
  158 + 'http://www.example.com/balance/arch.html?blow=aftermath&bait=bath',
  159 + 'http://authority.example.com/',
  160 + 'http://example.com/advice.html',
  161 + 'https://www.example.com/',
  162 + 'https://www.example.com/bee?act=art&bells=board',
  163 + 'http://example.org/',
  164 + 'https://www.example.com/',
  165 + 'https://example.com/bed',
  166 + 'https://www.example.edu/acoustics',
  167 + 'https://www.example.com/bells',
  168 + 'http://board.example.com/',
  169 + 'http://book.example.com/afterthought?advertisement=ball&birth=argument',
  170 + 'http://birds.example.org/ball.aspx?apparatus=border&brother=aftermath',
  171 + 'https://www.example.org/books/book?bedroom=birds',
  172 + 'http://advice.example.com/',
  173 + 'http://example.com/',
  174 + 'http://example.com/bedroom/alarm',
  175 + 'https://example.com/advice/approval',
  176 + 'http://anger.example.net/?breath=brother&air=bell#ball',
  177 + 'http://appliance.example.com/bee/badge',
  178 + 'http://www.example.org/berry.aspx',
  179 + 'http://example.org/',
  180 + ];
  181 +
  182 + for (final url in urls) {
  183 + expect(url.isURL, true);
  184 + }
  185 + expect(alphaNumeric.isURL, false);
  186 + });
  187 + test('var.isEmail', () {
  188 + final emails = [
  189 + 'hellfire@comcast.net',
  190 + 'hllam@icloud.com',
  191 + 'tskirvin@live.com',
  192 + 'choset@comcast.net',
  193 + 'parksh@live.com',
  194 + 'kassiesa@yahoo.com',
  195 + 'kramulous@comcast.net',
  196 + 'froodian@me.com',
  197 + 'shawnce@yahoo.ca',
  198 + 'cgreuter@gmail.com',
  199 + 'aprakash@verizon.net',
  200 + 'dhrakar@gmail.com',
  201 + 'wmszeliga@yahoo.ca',
  202 + 'bmorrow@icloud.com',
  203 + 'seurat@comcast.net',
  204 + 'dialworld@yahoo.ca',
  205 + 'johndo@yahoo.ca',
  206 + 'empathy@yahoo.com.pt',
  207 + 'openldap@verizon.net',
  208 + 'elflord@outlook.com',
  209 + 'kaiser@me.com',
  210 + 'carcus@att.net',
  211 + 'garland@hotmail.com',
  212 + 'clkao@yahoo.ca',
  213 + 'daveed@mac.com',
  214 + 'parasite@icloud.com',
  215 + 'drolsky@aol.com',
  216 + 'reziac@outlook.com',
  217 + 'storerm@yahoo.ca',
  218 + 'johnbob@hotmail.com.br',
  219 + ];
  220 +
  221 + for (final email in emails) {
  222 + expect(email.isEmail, true);
  223 + }
  224 + expect(alphaNumeric.isEmail, false);
  225 + });
  226 + test('var.isPhoneNumber', () {
  227 + final phoneNumbers = [
  228 + '+1202-555-0145',
  229 + '+1202-555-0139',
  230 + '+1202-555-0101',
  231 + '+1202-555-0136',
  232 + '+1202-555-0190',
  233 + '+1202-555-0156',
  234 + '(738) 952-5253',
  235 + '(861) 965-1597',
  236 + '(732) 372-9760',
  237 + '(532) 766-4719',
  238 + '(987) 472-7813',
  239 + '(455) 443-8171',
  240 + '(915) 685-8658',
  241 + '(572) 207-1898',
  242 +
  243 + // TODO those are failing, but they shouldn't
  244 + // '(81) 6 2499-9538',
  245 + // '(31) 32304-4263',
  246 + // '(64) 25242-6375',
  247 + // '(41) 19308-7925',
  248 + // '(67) 61684-0395',
  249 + // '(60) 54706-3569',
  250 + '(31) 33110055',
  251 + '(11) 3344-5599',
  252 + '(31) 977447788',
  253 + '(31) 66557744',
  254 + '(21) 946576541',
  255 + '(11) 3432-3333',
  256 + '02131973585858'
  257 + ];
  258 +
  259 + for (final phone in phoneNumbers) {
  260 + // print('testing $phone');
  261 + expect(phone.isPhoneNumber, true);
  262 + }
  263 +
  264 + final bigRandomNumber = '168468468465241327987624987327987';
  265 + expect(bigRandomNumber.isPhoneNumber, false);
  266 +
  267 + expect(alphaNumeric.isPhoneNumber, false);
  268 + });
  269 + test('var.isDateTime', () {
  270 + final dateTimes = [
  271 + '2003-07-05 05:51:47.000Z',
  272 + '1991-05-11 11:57:30.000Z',
  273 + '2002-01-04 10:00:41.000Z',
  274 + '1995-11-04 19:43:25.000Z',
  275 + '2006-07-12 20:06:46.000Z',
  276 + '2000-08-10 00:06:23.000Z',
  277 + '1998-07-31 10:56:50.000Z',
  278 + '1995-04-27 11:49:34.000Z',
  279 + '1998-07-26 15:43:11.000Z',
  280 + '1999-02-04 10:03:01.000Z',
  281 + '1998-05-02 12:17:55.000Z',
  282 + '2013-05-26 10:47:22.000Z',
  283 + '1991-07-07 20:25:42.000Z',
  284 + '2018-11-03 09:27:38.000Z',
  285 + '1992-12-22 08:20:26.000Z',
  286 + '1997-07-01 23:11:59.000Z',
  287 + '2012-04-13 16:00:04.000Z',
  288 + '1997-01-06 18:37:51.000Z',
  289 + '2008-08-23 11:11:29.000Z',
  290 + '1996-02-06 03:46:43.000Z',
  291 + '2016-01-03 10:57:15.000Z',
  292 + '2014-04-16 17:20:50.000Z',
  293 + '1994-07-13 03:55:16.000Z',
  294 + '2004-11-15 03:45:11.000Z',
  295 + '2007-12-18 18:21:21.000Z',
  296 + '1995-01-31 03:55:44.000Z',
  297 + '2013-08-09 04:48:37.000Z',
  298 + '2001-09-07 17:13:55.000Z',
  299 + '1993-06-18 13:21:21.000Z',
  300 + '1991-02-06 03:05:47.000Z',
  301 + '2000-09-22 18:48:55.000Z',
  302 + '2000-06-01 02:13:57.000Z',
  303 + '1991-08-07 21:08:35.000Z',
  304 + '1998-08-15 07:27:12.000Z',
  305 + '2002-07-03 10:34:25.000Z',
  306 + '2013-10-05 00:37:45.000Z',
  307 + '2012-09-10 20:07:21.000Z',
  308 + '2017-06-18 14:38:06.000Z',
  309 + '2000-03-09 11:27:49.000Z',
  310 + '2016-01-16 22:01:20.000Z',
  311 + ];
  312 +
  313 + for (final dateTime in dateTimes) {
  314 + // print('testing $dateTime');
  315 + expect(dateTime.isDateTime, true);
  316 + }
  317 + expect(alphaNumeric.isDateTime, false);
  318 + });
  319 + test('var.isMD5', () {
  320 + final md5s = [
  321 + '176cfa006065a2a2bd8d3f1f83531b64',
  322 + '713fca6d088132e863497a79d1bd9572',
  323 + '7decc2fb2aca5cbd8a2cae5de1b50edb',
  324 + '85ed9bc4e4a8ae65add67886f5dfe02f',
  325 + 'e4f0097f84a11f0298c83ecf6aa0fec3',
  326 + '70a2712b47127b431d7119b3a511b145',
  327 + 'dd54069e3f97787e79592f6e3a307e93',
  328 + '5b64677b69da7370ee69523281ce935c',
  329 + '6150ce23f4b071e1cde49021b57c5a17',
  330 + '2781566b09a84a695297482cdcb1ffd0',
  331 + '54fe4ce16862aac01768b5831390d557',
  332 + '2747268afaa9898a320b8cc5580f143e',
  333 + 'ce3c2d105fb2740c5bf59347b47603a8',
  334 + 'cccef3bbc8cd2530c6de78af586ebcee',
  335 + '502115b10c767f50ab55270be095512e',
  336 + 'b084ea385e849eaedf4fefaf6dd5f1a9',
  337 + '1f167339977225fe63a86388083fc64f',
  338 + '6abd5f472dba5e4688ad6dd14f975870',
  339 + '7e7f9ef53fb6e3ce2a4fb56665548eb8',
  340 + 'de134fce82421dd2b3fab751fbfa190d',
  341 + 'b0d8492572a52d1f2360535612c5dc82',
  342 + ];
  343 +
  344 + for (final md5 in md5s) {
  345 + expect(md5.isMD5, true);
  346 + }
  347 +
  348 + expect(alphaNumeric.isMD5, false);
  349 + });
  350 + test('var.isSHA1', () {
  351 + final sha1s = [
  352 + '1A310CF5DC8CE513586F74EE19CE90BD4BCC5AED',
  353 + 'B458B077B5075C316CFD03619D627F529A0555BF',
  354 + '902C6A2850B4348BE445D637689CCAE5C5EF3552',
  355 + '8DC86C0DD0FD2960D62573AB142F90572A7421D5',
  356 + '7E18C8EA5F05BB2F385A9E34657B8D439A83BF82',
  357 + '3EC857A133E801C0B3198371C17C1A3A3D73DFE8',
  358 + 'E32590E41805BEFD524205DAE0A56F429DCCC4E7',
  359 + '943A9164A126457203680B49F0309B5F15F0117E',
  360 + 'C5E1442484AF49A92E1CC51F95AE4E8305F49DB6',
  361 + 'B0C3B071F8ADBEE2222AA07ECFF51C3C040AA0A0',
  362 + '722ED6929057BF801F29590C423A40F4EF8C710E',
  363 + 'F484FA4DC5EC1E063F0752112D9BF3B9763D6E41',
  364 + '2A87522644011223A27FD62C87FA926A1838F271',
  365 + ];
  366 +
  367 + for (final sha1 in sha1s) {
  368 + expect(sha1.isSHA1, true);
  369 + }
  370 +
  371 + expect(alphaNumeric.isSHA1, false);
  372 + });
  373 + test('var.isSHA256', () {
  374 + final sha256s = [
  375 + 'FC694FFE78167EAE21EA4EBF072D8AB6ECF847162D1F65600BF019BA9805DB2D',
  376 + '3B64F1C349B548E72688A8EEFFA2F418A62BA2E22CF5BD954B4B1912C963D7FA',
  377 + 'EF69D763148B8A222980BD164943F754937DF12771083889DDB69C18245C2904',
  378 + '9896D3134156E546FFC003C2C9CFED88D46C2BC214B39CF21192EAAF875A7C0A',
  379 + '2C70E9735D7DAB56427BAA09E6C63912BEAD9C7938F6B16C4954B78F46D1C3CF',
  380 + '423E095C8074BC1C440D874D999C18025445CD39211D98362E827E55863DD0B2',
  381 + '4FCDB44D5521663F713A5821DE9401D64D44050C2AF62EBA758B1D128AC4C279',
  382 + 'BD91C9BBC044C94C283D0DF3AA1E8CDBF1BF35BF325E8196BA15FCA5238A3A40',
  383 + '7B9434447F3B1236221D40CB707D1909886CC9E8CA25EB18DCCFDC70F0A3AE9F',
  384 + 'FBD3A0B1C5F9906EF3BFB5EDD846F77BA252070E036EC1F4F57BDD912F02987D',
  385 + 'B8369EE116ADE797285DC973DDAA69433F255DC0AEEC7936378D4D08B2A7FDD2',
  386 + '6B6FE6891A5DFCCF2900A2A1F513196827AF5A95AB2DE1590B878BEFCCF12603',
  387 + 'F2CB3614CD070450912EBEC399C63527D2A839C4E5BB2FE281BA1C5D5EA64257',
  388 + '822805E8FA05909AD7D3D6DBFBB1AE61D7A3C70209DB2A37C415BD5E11764866',
  389 + '40DAC792B52101BB1506AD880F0378EFACF46B019427A3D0E01DE2B09B06B6ED',
  390 + 'E765A129579AF2F31C681973844490F8EA146DA8ADC07671F9FB71F0FE10E296',
  391 + '2B5B6DC7EF398D1420D23327295BCDCDDA8AAEDB7FE6C6129D1D31432B676CB7',
  392 + '67F20826370162C472791055E10E44624D40E35F29E60592B239692836474323',
  393 + 'BD16B1ED024E353B5B2334201EC63C0B3E181F0DFD226A36825EF18F6A7D8D97',
  394 + 'AC98F969AA56810BE672C770BE30EF79F7F77AE6EFB2A90D56FA2AD5506D8BD7',
  395 + ];
  396 +
  397 + for (final sha256 in sha256s) {
  398 + expect(sha256.isSHA256, true);
  399 + }
  400 +
  401 + expect(alphaNumeric.isSHA256, false);
  402 + });
  403 + test('var.isBinary', () {
  404 + final binaries = [
  405 + '00111100',
  406 + '00001111',
  407 + '10110110',
  408 + '01101110',
  409 + '01110101',
  410 + '00010100',
  411 + '11100010',
  412 + '11000001',
  413 + '11000110',
  414 + '11011101',
  415 + '10001101',
  416 + '10101110',
  417 + '11001110',
  418 + '10001011',
  419 + '11111101',
  420 + '11010110',
  421 + '11110011',
  422 + '01111010',
  423 + '11110011',
  424 + '01000111',
  425 + ];
  426 +
  427 + for (final binary in binaries) {
  428 + expect(binary.isBinary, true);
  429 + }
  430 +
  431 + expect(alphaNumeric.isBinary, false);
  432 + });
  433 + test('var.isIPv4', () {
  434 + final ipv4s = [
  435 + '155.162.247.250',
  436 + '121.99.222.180',
  437 + '142.197.183.237',
  438 + '176.60.213.134',
  439 + '12.190.123.58',
  440 + '105.75.28.173',
  441 + '121.120.116.138',
  442 + '20.195.194.189',
  443 + '234.171.207.97',
  444 + '153.122.129.170',
  445 + '224.226.28.80',
  446 + '236.196.62.84',
  447 + '122.71.160.46',
  448 + '151.24.85.63',
  449 + '37.109.242.32',
  450 + '235.47.62.53',
  451 + '151.1.242.190',
  452 + '227.197.221.85',
  453 + '12.118.136.231',
  454 + '51.73.246.208',
  455 + ];
  456 +
  457 + for (final ipv4 in ipv4s) {
  458 + expect(ipv4.isIPv4, true);
  459 + }
  460 +
  461 + expect(alphaNumeric.isIPv4, false);
  462 + });
  463 + test('var.isIPv6', () {
  464 + final ipv6s = [
  465 + 'f856:62fc:9091:e649:e928:d771:f40c:1439',
  466 + 'b8d5:3f85:5ae5:c63a:6b5f:f7e6:ea6b:871d',
  467 + '2f91:979a:90b0:55d1:40b7:3e6f:a210:598e',
  468 + 'd35d:49fc:fbe4:9841:e4d3:f006:b04b:e242',
  469 + '2e0f:2912:e4e8:33d5:e833:0ac5:c73a:30b3',
  470 + '6af9:878a:a80f:f520:fc2b:a05c:b0dd:b93f',
  471 + '3329:1ce5:ab09:0120:945c:057b:ed4a:7869',
  472 + 'b77d:5523:2f1b:ff07:93a5:378f:a9c7:e2f2',
  473 + 'b669:64fa:1be7:af47:28fc:07f4:38bd:ae05',
  474 + 'aa77:1f7e:8539:a01a:706d:6f74:7fc3:8407',
  475 + '16f9:9bcc:32d6:96de:5087:620b:c0c0:25cb',
  476 + 'baad:273f:7e63:29cd:c742:c1ed:d0f9:062d',
  477 + 'ae62:5b09:05fa:4611:5da9:a40a:f1ef:2a9d',
  478 + '4d2a:353a:9f6b:2070:9605:ab97:92c0:7956',
  479 + 'bfcb:39f8:5119:458f:85fa:9e54:8c53:acd5',
  480 + '0c1a:c6f3:06af:9588:23b4:e7fb:c307:febd',
  481 + 'ddaa:3c91:f554:dbe5:8447:9464:a9ae:2200',
  482 + '8787:c939:5002:a4f6:19b2:6521:4cde:8111',
  483 + 'b515:5c17:6590:46dd:4ca8:1db3:a86c:e006',
  484 + '1083:d492:f42e:2c99:f050:f67f:07c5:23f9',
  485 + ];
  486 +
  487 + for (final ipv6 in ipv6s) {
  488 + expect(ipv6.isIPv6, true);
  489 + }
  490 +
  491 + expect(alphaNumeric.isIPv6, false);
  492 + });
  493 + test('var.isHexadecimal', () {
  494 + final hexadecimals = [
  495 + '#56E97B',
  496 + '#597E2A',
  497 + '#F45D5C',
  498 + '#A350DC',
  499 + '#2DA48E',
  500 + '#98CB3C',
  501 + '#F7DCD1',
  502 + '#B1F9BE',
  503 + '#D17855',
  504 + '#6F35CB',
  505 + '#DCBE21',
  506 + '#4C2E46',
  507 + '#145F3F',
  508 + '#F9776D',
  509 + '#62E9DC',
  510 + '#2F1030',
  511 + '#C4F888',
  512 + '#8E6D85',
  513 + '#8C64CE',
  514 + '#4DFF4E',
  515 + ];
  516 +
  517 + for (final hexadecimal in hexadecimals) {
  518 + expect(hexadecimal.isHexadecimal, true);
  519 + }
  520 +
  521 + expect(alphaNumeric.isHexadecimal, false);
  522 + });
  523 + test('var.isPalindrom', () {
  524 + final palindroms = [
  525 + 'Anna',
  526 + 'Civic',
  527 + 'Kayak',
  528 + 'Level',
  529 + 'Madam',
  530 + 'Mom',
  531 + 'Noon',
  532 + 'Racecar',
  533 + 'Radar',
  534 + 'Redder',
  535 + 'Refer',
  536 + 'Repaper',
  537 + 'Don\'t nod.',
  538 + 'I did, did I?',
  539 + 'My gym',
  540 + 'Red rum, sir, is murder',
  541 + 'Step on no pets',
  542 + 'Top spot',
  543 + 'Was it a cat I saw?',
  544 + 'Eva, can I see bees in a cave?',
  545 + 'No lemon, no melon',
  546 + 'A base do teto desaba.',
  547 + 'A cara rajada da jararaca.',
  548 + 'Acuda cadela da Leda caduca.',
  549 + 'A dama admirou o rim da amada.',
  550 + 'A Daniela ama a lei? Nada!',
  551 +
  552 + // TODO make isPalindrom regex support UTF8 characters
  553 + // 'Adias a data da saída.',
  554 + // 'A diva em Argel alegra-me a vida.',
  555 + // 'A droga do dote é todo da gorda.',
  556 + // 'A gorda ama a droga.',
  557 + // 'A grama é amarga.',
  558 + // 'Aí, Lima falou: “Olá, família!”.',
  559 + // 'anã',
  560 + // 'anilina',
  561 + // 'ata',
  562 + // 'arara',
  563 + // 'asa',
  564 + // 'ele',
  565 + // 'esse',
  566 + // 'mamam',
  567 + // 'matam',
  568 + // 'metem',
  569 + // 'mirim',
  570 + // 'oco',
  571 + // 'omissíssimo',
  572 + ];
  573 + for (final palindrom in palindroms) {
  574 + // print("testing $palindrom");
  575 + expect(palindrom.isPalindrom, true);
  576 + }
  577 + expect(alphaNumeric.isPalindrom, false);
  578 + });
  579 + test('var.isPassport', () {
  580 + final passports = [
  581 + '12ss46',
  582 + 'jdmg5dg',
  583 + '5f7fj5d7',
  584 + 'w8a9s6f3z',
  585 + ];
  586 +
  587 + for (final passport in passports) {
  588 + expect(passport.isPassport, true);
  589 + }
  590 +
  591 + expect(specialCaracters.isPassport, false);
  592 + });
  593 +
  594 + test('var.isCurrency', () {
  595 + final currencies = [
  596 + 'R\$50.58',
  597 + '\$82.48',
  598 + '\₩54.24',
  599 + '\¥81.04',
  600 + '\€4.06',
  601 + '\₹37.40',
  602 + '\₽18.12',
  603 + 'fr95.15',
  604 + 'R81.04',
  605 + '9.35USD',
  606 + '98.48AUD',
  607 + '29.20NZD',
  608 + '50.58CAD',
  609 + '82.48CHF',
  610 + '54.24GBP',
  611 + '81.04CNY',
  612 + '4.06EUR',
  613 + '37.40JPY',
  614 + '18.12IDR',
  615 + '95.15MXN',
  616 + '81.04NOK',
  617 + '9.35KRW',
  618 + '98.48TRY',
  619 + '29.20INR',
  620 + ];
  621 +
  622 + for (final currency in currencies) {
  623 + // print('currency $currency');
  624 + expect(currency.isCurrency, true);
  625 + }
  626 +
  627 + expect(specialCaracters.isCurrency, false);
  628 + });
  629 +
  630 + test('var.isCpf', () {
  631 + final cpfs = [
  632 + '370.559.380-31',
  633 + '055.878.430-50',
  634 + '655.232.870-24',
  635 + '86497047000',
  636 + '12341309046',
  637 + '31496294033',
  638 + ];
  639 +
  640 + for (final cpf in cpfs) {
  641 + expect(cpf.isCpf, true);
  642 + }
  643 +
  644 + expect(specialCaracters.isCpf, false);
  645 + });
  646 + test('var.isCnpj', () {
  647 + final cnpjs = [
  648 + '11.066.893/0001-94',
  649 + '21.883.660/0001-38',
  650 + '59.705.218/0001-94',
  651 + ];
  652 +
  653 + for (final cnpj in cnpjs) {
  654 + expect(cnpj.isCnpj, true);
  655 + }
  656 +
  657 + expect(specialCaracters.isCnpj, false);
  658 + });
  659 +
  660 + test('var.isCaseInsensitiveContains(string)', () {
  661 + final phrase = 'Back to Square One';
  662 +
  663 + expect(phrase.isCaseInsensitiveContains('to'), true);
  664 + expect(phrase.isCaseInsensitiveContains('square'), true);
  665 + expect(phrase.isCaseInsensitiveContains('On'), true);
  666 + expect(phrase.isCaseInsensitiveContains('foo'), false);
  667 + });
  668 +
  669 + test('var.isCaseInsensitiveContainsAny(string)', () {
  670 + final phrase = 'Back to Square One';
  671 +
  672 + expect(phrase.isCaseInsensitiveContainsAny('to'), true);
  673 + expect(phrase.isCaseInsensitiveContainsAny('square'), true);
  674 + expect(phrase.isCaseInsensitiveContainsAny('On'), true);
  675 + expect(phrase.isCaseInsensitiveContainsAny('foo'), false);
  676 + expect('to'.isCaseInsensitiveContainsAny(phrase), true);
  677 + expect('square'.isCaseInsensitiveContainsAny('qu'), true);
  678 + });
  679 +
  680 + test('var.capitalize', () {
  681 + expect('foo bar'.capitalize, 'Foo Bar');
  682 + expect('FoO bAr'.capitalize, 'Foo Bar');
  683 + expect('FOO BAR'.capitalize, 'Foo Bar');
  684 + expect(''.capitalize, null);
  685 + });
  686 +
  687 + test('var.capitalizeFirst', () {
  688 + expect('foo bar'.capitalizeFirst, 'Foo bar');
  689 + expect('FoO bAr'.capitalizeFirst, 'Foo bar');
  690 + expect('FOO BAR'.capitalizeFirst, 'Foo bar');
  691 + expect(''.capitalizeFirst, null);
  692 + });
  693 +
  694 + test('var.removeAllWhitespace', () {
  695 + expect('foo bar'.removeAllWhitespace, 'foobar');
  696 + expect('foo'.removeAllWhitespace, 'foo');
  697 + expect(''.removeAllWhitespace, null);
  698 + });
  699 +
  700 + test('var.camelCase', () {
  701 + expect('foo bar'.camelCase, 'fooBar');
  702 + expect('the fox jumped in the water'.camelCase, 'theFoxJumpedInTheWater');
  703 + expect(''.camelCase, null);
  704 + });
  705 +
  706 + test('var.numericOnly()', () {
  707 + expect('date: 2020/09/13, time: 00:00'.numericOnly(), '202009130000');
  708 + expect(
  709 + 'and 1, and 2, and 1 2 3'.numericOnly(),
  710 + '12123',
  711 + );
  712 + expect(''.numericOnly(), '');
17 }); 713 });
18 }); 714 });
19 } 715 }