progs/matcher/re2.sc
changeset 826 b0352633bf48
parent 825 dca072e2bb7d
child 879 ad9d4a01e072
equal deleted inserted replaced
825:dca072e2bb7d 826:b0352633bf48
    72   (end - start) / (i * 1.0e9)
    72   (end - start) / (i * 1.0e9)
    73 }
    73 }
    74 
    74 
    75 
    75 
    76 
    76 
    77 @doc("Test (a?{n}) (a{n})")
    77 @arg(doc = "Test (a?{n}) (a{n})")
    78 @main
    78 @main
    79 def test1() = {
    79 def test1() = {
    80   println("Test (a?{n}) (a{n})")
    80   println("Test (a?{n}) (a{n})")
    81 
    81 
    82   for (i <- 0 to 1000 by 100) {
    82   for (i <- 0 to 1000 by 100) {
    83     println(f"$i: ${time_needed(1, matcher(EVIL1(i), "a" * i))}%.5f")
    83     println(f"$i: ${time_needed(1, matcher(EVIL1(i), "a" * i))}%.5f")
    84   }
    84   }
    85 }  
    85 }  
    86 
    86 
    87 
    87 
    88 @doc("Test (a*)* b")
    88 @arg(doc = "Test (a*)* b")
    89 @main
    89 @main
    90 def test2() = {
    90 def test2() = {
    91   println("Test (a*)* b")
    91   println("Test (a*)* b")
    92 
    92 
    93   for (i <- 0 to 30 by 2) {
    93   for (i <- 0 to 30 by 2) {
   139 
   139 
   140 size(ders(("a" * 20).toList, EVIL2)) // 7340068
   140 size(ders(("a" * 20).toList, EVIL2)) // 7340068
   141 
   141 
   142 
   142 
   143 
   143 
   144 @doc("All tests.")
   144 @arg(doc = "All tests.")
   145 @main
   145 @main
   146 def all() = { test1(); test2() } 
   146 def all() = { test1(); test2() } 
       
   147 
       
   148 
       
   149 
       
   150 
       
   151 // runs with amm2 and amm3