﻿namespace Email.Tests

open Expecto
open FsRegEx

module ComplexEmail =

    [<Literal>]
    /// RFC 5322 Official Standard regex from http://emailregex.com/
    let ComplexEmailRegex = """(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])"""
    let complexEmailRegex = new FsRegEx(ComplexEmailRegex)

    [<Tests>]
    let testComplexEmail =
        testList "ComplexEmail" [
            RFC822.test1 complexEmailRegex.IsMatch 
            RFC822.test2 complexEmailRegex.IsMatch
            RFC822.test3 complexEmailRegex.IsMatch
            RFC822.test4 complexEmailRegex.IsMatch
            RFC822.test5 complexEmailRegex.IsMatch
            RFC822.test6 complexEmailRegex.IsMatch
            RFC822.test7 complexEmailRegex.IsMatch
            RFC822.test8 complexEmailRegex.IsMatch
            RFC822.test9 complexEmailRegex.IsMatch
            RFC822.test10 complexEmailRegex.IsMatch
            RFC822.test11 complexEmailRegex.IsMatch
            RFC822.test12 complexEmailRegex.IsMatch
            RFC822.test13 complexEmailRegex.IsMatch
            RFC822.test14 complexEmailRegex.IsMatch
            RFC822.test15 complexEmailRegex.IsMatch
            RFC822.test16 complexEmailRegex.IsMatch
            RFC822.test17 complexEmailRegex.IsMatch
            RFC822.test18 complexEmailRegex.IsMatch
            RFC822.test19 complexEmailRegex.IsMatch
            RFC822.test20 complexEmailRegex.IsMatch
            RFC822.test21 complexEmailRegex.IsMatch
            RFC822.test22 complexEmailRegex.IsMatch
            RFC822.test23 complexEmailRegex.IsMatch
            RFC822.test24 complexEmailRegex.IsMatch
            RFC822.test25 complexEmailRegex.IsMatch
            RFC822.test26 complexEmailRegex.IsMatch
            RFC822.test27 complexEmailRegex.IsMatch
            RFC822.test28 complexEmailRegex.IsMatch
            RFC822.test29 complexEmailRegex.IsMatch
            RFC822.test30 complexEmailRegex.IsMatch
            RFC822.test31 complexEmailRegex.IsMatch
            RFC822.test32 complexEmailRegex.IsMatch
            RFC822.test33 complexEmailRegex.IsMatch
            RFC822.test34 complexEmailRegex.IsMatch
            RFC822.test35 complexEmailRegex.IsMatch
            RFC822.test36 complexEmailRegex.IsMatch
            RFC822.test37 complexEmailRegex.IsMatch
            RFC822.test38 complexEmailRegex.IsMatch
            RFC822.test39 complexEmailRegex.IsMatch
            RFC822.test40 complexEmailRegex.IsMatch
            RFC822.test41 complexEmailRegex.IsMatch
            RFC822.test42 complexEmailRegex.IsMatch
            RFC822.test43 complexEmailRegex.IsMatch
            RFC822.test44 complexEmailRegex.IsMatch
            RFC822.test45 complexEmailRegex.IsMatch
            RFC822.test46 complexEmailRegex.IsMatch
            RFC822.test47 complexEmailRegex.IsMatch
            RFC822.test48 complexEmailRegex.IsMatch
            RFC822.test49 complexEmailRegex.IsMatch
            RFC822.test50 complexEmailRegex.IsMatch
            RFC822.test51 complexEmailRegex.IsMatch
            RFC822.test52 complexEmailRegex.IsMatch
            RFC822.test53 complexEmailRegex.IsMatch
            RFC822.test54 complexEmailRegex.IsMatch
            RFC822.test55 complexEmailRegex.IsMatch
            RFC822.test56 complexEmailRegex.IsMatch
            RFC822.test57 complexEmailRegex.IsMatch
            RFC822.test58 complexEmailRegex.IsMatch
            RFC822.test59 complexEmailRegex.IsMatch
            RFC822.test60 complexEmailRegex.IsMatch
            RFC822.test61 complexEmailRegex.IsMatch
            RFC822.test62 complexEmailRegex.IsMatch
            RFC822.test63 complexEmailRegex.IsMatch
            RFC822.test64 complexEmailRegex.IsMatch
            RFC822.test65 complexEmailRegex.IsMatch
            RFC822.test66 complexEmailRegex.IsMatch
            RFC822.test67 complexEmailRegex.IsMatch
            RFC822.test68 complexEmailRegex.IsMatch
            RFC822.test69 complexEmailRegex.IsMatch
            RFC822.test70 complexEmailRegex.IsMatch
            RFC822.test71 complexEmailRegex.IsMatch
            RFC822.test72 complexEmailRegex.IsMatch
            RFC822.test73 complexEmailRegex.IsMatch
            RFC822.test74 complexEmailRegex.IsMatch
            RFC822.test75 complexEmailRegex.IsMatch
            RFC822.test76 complexEmailRegex.IsMatch
            RFC822.test77 complexEmailRegex.IsMatch
            RFC822.test78 complexEmailRegex.IsMatch
            RFC822.test79 complexEmailRegex.IsMatch
            RFC822.test80 complexEmailRegex.IsMatch
            RFC822.test81 complexEmailRegex.IsMatch
            RFC822.test82 complexEmailRegex.IsMatch
            RFC822.test83 complexEmailRegex.IsMatch
            RFC822.test84 complexEmailRegex.IsMatch
            RFC822.test85 complexEmailRegex.IsMatch
            RFC822.test86 complexEmailRegex.IsMatch
            RFC822.test87 complexEmailRegex.IsMatch
            RFC822.test88 complexEmailRegex.IsMatch
            RFC822.test89 complexEmailRegex.IsMatch
            RFC822.test90 complexEmailRegex.IsMatch
            RFC822.test91 complexEmailRegex.IsMatch
            RFC822.test92 complexEmailRegex.IsMatch
            RFC822.test93 complexEmailRegex.IsMatch
            RFC822.test94 complexEmailRegex.IsMatch
            RFC822.test95 complexEmailRegex.IsMatch
            RFC822.test96 complexEmailRegex.IsMatch
            RFC822.test97 complexEmailRegex.IsMatch
            RFC822.test98 complexEmailRegex.IsMatch
            RFC822.test99 complexEmailRegex.IsMatch
            RFC822.test100 complexEmailRegex.IsMatch
            RFC822.test101 complexEmailRegex.IsMatch
            RFC822.test102 complexEmailRegex.IsMatch
            RFC822.test103 complexEmailRegex.IsMatch
            RFC822.test104 complexEmailRegex.IsMatch
            RFC822.test105 complexEmailRegex.IsMatch
            RFC822.test106 complexEmailRegex.IsMatch
            RFC822.test107 complexEmailRegex.IsMatch
            RFC822.test108 complexEmailRegex.IsMatch
            RFC822.test109 complexEmailRegex.IsMatch
            RFC822.test110 complexEmailRegex.IsMatch
            RFC822.test111 complexEmailRegex.IsMatch
            RFC822.test112 complexEmailRegex.IsMatch
            RFC822.test113 complexEmailRegex.IsMatch
            RFC822.test114 complexEmailRegex.IsMatch
            RFC822.test115 complexEmailRegex.IsMatch
            RFC822.test116 complexEmailRegex.IsMatch
            RFC822.test117 complexEmailRegex.IsMatch
            RFC822.test118 complexEmailRegex.IsMatch
            RFC822.test119 complexEmailRegex.IsMatch
            RFC822.test120 complexEmailRegex.IsMatch
            RFC822.test121 complexEmailRegex.IsMatch
            RFC822.test122 complexEmailRegex.IsMatch
            RFC822.test123 complexEmailRegex.IsMatch
            RFC822.test124 complexEmailRegex.IsMatch
            RFC822.test125 complexEmailRegex.IsMatch
            RFC822.test126 complexEmailRegex.IsMatch
            RFC822.test127 complexEmailRegex.IsMatch
            RFC822.test128 complexEmailRegex.IsMatch
            RFC822.test129 complexEmailRegex.IsMatch
            RFC822.test130 complexEmailRegex.IsMatch
            RFC822.test131 complexEmailRegex.IsMatch
            RFC822.test132 complexEmailRegex.IsMatch
            RFC822.test133 complexEmailRegex.IsMatch
            RFC822.test134 complexEmailRegex.IsMatch
            RFC822.test135 complexEmailRegex.IsMatch
            RFC822.test136 complexEmailRegex.IsMatch
            RFC822.test137 complexEmailRegex.IsMatch
            RFC822.test138 complexEmailRegex.IsMatch
            RFC822.test139 complexEmailRegex.IsMatch
            RFC822.test140 complexEmailRegex.IsMatch
            RFC822.test141 complexEmailRegex.IsMatch
            RFC822.test142 complexEmailRegex.IsMatch
            RFC822.test143 complexEmailRegex.IsMatch
            RFC822.test144 complexEmailRegex.IsMatch
            RFC822.test145 complexEmailRegex.IsMatch
            RFC822.test146 complexEmailRegex.IsMatch
            RFC822.test147 complexEmailRegex.IsMatch
            RFC822.test148 complexEmailRegex.IsMatch
            RFC822.test149 complexEmailRegex.IsMatch
            RFC822.test150 complexEmailRegex.IsMatch
            RFC822.test151 complexEmailRegex.IsMatch
            RFC822.test152 complexEmailRegex.IsMatch
            RFC822.test153 complexEmailRegex.IsMatch
            RFC822.test154 complexEmailRegex.IsMatch
            RFC822.test155 complexEmailRegex.IsMatch
            RFC822.test156 complexEmailRegex.IsMatch
            RFC822.test157 complexEmailRegex.IsMatch
            RFC822.test158 complexEmailRegex.IsMatch
            RFC822.test159 complexEmailRegex.IsMatch
            RFC822.test160 complexEmailRegex.IsMatch
            RFC822.test161 complexEmailRegex.IsMatch
            RFC822.test162 complexEmailRegex.IsMatch
            RFC822.test163 complexEmailRegex.IsMatch
            RFC822.test164 complexEmailRegex.IsMatch
            RFC822.test165 complexEmailRegex.IsMatch
            RFC822.test166 complexEmailRegex.IsMatch
            RFC822.test167 complexEmailRegex.IsMatch
            RFC822.test168 complexEmailRegex.IsMatch
            RFC822.test169 complexEmailRegex.IsMatch
            RFC822.test170 complexEmailRegex.IsMatch
            RFC822.test171 complexEmailRegex.IsMatch
            RFC822.test172 complexEmailRegex.IsMatch
            RFC822.test173 complexEmailRegex.IsMatch
            RFC822.test174 complexEmailRegex.IsMatch
            RFC822.test175 complexEmailRegex.IsMatch
            RFC822.test176 complexEmailRegex.IsMatch
            RFC822.test177 complexEmailRegex.IsMatch
            RFC822.test178 complexEmailRegex.IsMatch
            RFC822.test179 complexEmailRegex.IsMatch
            RFC822.test180 complexEmailRegex.IsMatch
            RFC822.test181 complexEmailRegex.IsMatch
            RFC822.test182 complexEmailRegex.IsMatch
            RFC822.test183 complexEmailRegex.IsMatch
            RFC822.test184 complexEmailRegex.IsMatch
            RFC822.test185 complexEmailRegex.IsMatch
            RFC822.test186 complexEmailRegex.IsMatch
            RFC822.test187 complexEmailRegex.IsMatch
            RFC822.test188 complexEmailRegex.IsMatch
            RFC822.test189 complexEmailRegex.IsMatch
            RFC822.test190 complexEmailRegex.IsMatch
            RFC822.test191 complexEmailRegex.IsMatch
            RFC822.test192 complexEmailRegex.IsMatch
            RFC822.test193 complexEmailRegex.IsMatch
            RFC822.test194 complexEmailRegex.IsMatch
            RFC822.test195 complexEmailRegex.IsMatch
            RFC822.test196 complexEmailRegex.IsMatch
            RFC822.test197 complexEmailRegex.IsMatch
            RFC822.test198 complexEmailRegex.IsMatch
            RFC822.test199 complexEmailRegex.IsMatch
            RFC822.test200 complexEmailRegex.IsMatch
            RFC822.test201 complexEmailRegex.IsMatch
            RFC822.test202 complexEmailRegex.IsMatch
            RFC822.test203 complexEmailRegex.IsMatch
            RFC822.test204 complexEmailRegex.IsMatch
            RFC822.test205 complexEmailRegex.IsMatch
            RFC822.test206 complexEmailRegex.IsMatch
            RFC822.test207 complexEmailRegex.IsMatch
            RFC822.test208 complexEmailRegex.IsMatch
            RFC822.test209 complexEmailRegex.IsMatch
            RFC822.test210 complexEmailRegex.IsMatch
            RFC822.test211 complexEmailRegex.IsMatch
            RFC822.test212 complexEmailRegex.IsMatch
            RFC822.test213 complexEmailRegex.IsMatch
            RFC822.test214 complexEmailRegex.IsMatch
            RFC822.test215 complexEmailRegex.IsMatch
            RFC822.test216 complexEmailRegex.IsMatch
            RFC822.test217 complexEmailRegex.IsMatch
            RFC822.test218 complexEmailRegex.IsMatch
            RFC822.test219 complexEmailRegex.IsMatch
            RFC822.test220 complexEmailRegex.IsMatch
            RFC822.test221 complexEmailRegex.IsMatch
            RFC822.test222 complexEmailRegex.IsMatch
            RFC822.test223 complexEmailRegex.IsMatch
            RFC822.test224 complexEmailRegex.IsMatch
            RFC822.test225 complexEmailRegex.IsMatch
            RFC822.test226 complexEmailRegex.IsMatch
            RFC822.test227 complexEmailRegex.IsMatch
            RFC822.test228 complexEmailRegex.IsMatch
            RFC822.test229 complexEmailRegex.IsMatch
            RFC822.test230 complexEmailRegex.IsMatch
            RFC822.test231 complexEmailRegex.IsMatch
            RFC822.test232 complexEmailRegex.IsMatch
            RFC822.test233 complexEmailRegex.IsMatch
            RFC822.test234 complexEmailRegex.IsMatch
            RFC822.test235 complexEmailRegex.IsMatch
            RFC822.test236 complexEmailRegex.IsMatch
            RFC822.test237 complexEmailRegex.IsMatch
            RFC822.test238 complexEmailRegex.IsMatch
            RFC822.test239 complexEmailRegex.IsMatch
            RFC822.test240 complexEmailRegex.IsMatch
            RFC822.test241 complexEmailRegex.IsMatch
            RFC822.test242 complexEmailRegex.IsMatch
            RFC822.test243 complexEmailRegex.IsMatch
            RFC822.test244 complexEmailRegex.IsMatch
            RFC822.test245 complexEmailRegex.IsMatch
            RFC822.test246 complexEmailRegex.IsMatch
            RFC822.test247 complexEmailRegex.IsMatch
            RFC822.test248 complexEmailRegex.IsMatch
            RFC822.test249 complexEmailRegex.IsMatch
            RFC822.test250 complexEmailRegex.IsMatch
            RFC822.test251 complexEmailRegex.IsMatch
            RFC822.test252 complexEmailRegex.IsMatch
            RFC822.test253 complexEmailRegex.IsMatch
            RFC822.test254 complexEmailRegex.IsMatch
            RFC822.test255 complexEmailRegex.IsMatch
            RFC822.test256 complexEmailRegex.IsMatch
            RFC822.test257 complexEmailRegex.IsMatch
            RFC822.test258 complexEmailRegex.IsMatch
            RFC822.test259 complexEmailRegex.IsMatch
            RFC822.test260 complexEmailRegex.IsMatch
            RFC822.test261 complexEmailRegex.IsMatch
            RFC822.test262 complexEmailRegex.IsMatch
            RFC822.test263 complexEmailRegex.IsMatch
            RFC822.test264 complexEmailRegex.IsMatch
            RFC822.test265 complexEmailRegex.IsMatch
            RFC822.test266 complexEmailRegex.IsMatch
            RFC822.test267 complexEmailRegex.IsMatch
            RFC822.test268 complexEmailRegex.IsMatch
            RFC822.test269 complexEmailRegex.IsMatch
            RFC822.test270 complexEmailRegex.IsMatch
            RFC822.test271 complexEmailRegex.IsMatch
            RFC822.test272 complexEmailRegex.IsMatch
            RFC822.test273 complexEmailRegex.IsMatch
            RFC822.test274 complexEmailRegex.IsMatch
            RFC822.test275 complexEmailRegex.IsMatch
            RFC822.test276 complexEmailRegex.IsMatch
            RFC822.test277 complexEmailRegex.IsMatch
            RFC822.test278 complexEmailRegex.IsMatch
            RFC822.test279 complexEmailRegex.IsMatch
            RFC822.test280 complexEmailRegex.IsMatch
            ]


