/[svn]/linuxsampler/trunk/src/scriptvm/tests/NKSPTest.cpp
ViewVC logotype

Diff of /linuxsampler/trunk/src/scriptvm/tests/NKSPTest.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 3575 by schoenebeck, Wed Aug 28 11:12:04 2019 UTC revision 3577 by schoenebeck, Wed Aug 28 15:23:23 2019 UTC
# Line 2382  end on Line 2382  end on
2382          .expectParseError = true // because min() function requires 2 arguments          .expectParseError = true // because min() function requires 2 arguments
2383      });      });
2384    
2385        // integer tests ...
2386    
2387      runScript({      runScript({
2388          .code = R"NKSP_CODE(          .code = R"NKSP_CODE(
2389  on init  on init
# Line 2402  end on Line 2404  end on
2404          .expectIntExitResult = -30          .expectIntExitResult = -30
2405      });      });
2406    
2407        // real number tests ...
2408    
2409        runScript({
2410            .code = R"NKSP_CODE(
2411    on init
2412      declare $foo := min(1.0, 2.0)
2413      exit($foo)
2414    end on
2415    )NKSP_CODE",
2416            .expectRealExitResult = 1.0
2417        });
2418    
2419        runScript({
2420            .code = R"NKSP_CODE(
2421    on init
2422      declare $foo := min(-30.0, 4.0)
2423      exit($foo)
2424    end on
2425    )NKSP_CODE",
2426            .expectRealExitResult = -30.0
2427        });
2428    
2429        runScript({
2430            .code = R"NKSP_CODE(
2431    on init
2432      declare $foo := min(1.1, 1.13)
2433      exit($foo)
2434    end on
2435    )NKSP_CODE",
2436            .expectRealExitResult = 1.1
2437        });
2438    
2439        runScript({
2440            .code = R"NKSP_CODE(
2441    on init
2442      declare $foo := min(1.13, 1.1)
2443      exit($foo)
2444    end on
2445    )NKSP_CODE",
2446            .expectRealExitResult = 1.1
2447        });
2448    
2449        // mixed type tests ...
2450    
2451        runScript({
2452            .code = R"NKSP_CODE(
2453    on init
2454      declare $foo := min(1, 1.16)
2455      exit($foo)
2456    end on
2457    )NKSP_CODE",
2458            .expectRealExitResult = 1.0
2459        });
2460    
2461        runScript({
2462            .code = R"NKSP_CODE(
2463    on init
2464      declare $foo := min(-3.92, 9)
2465      exit($foo)
2466    end on
2467    )NKSP_CODE",
2468            .expectRealExitResult = -3.92
2469        });
2470    
2471      #if !SILENT_TEST      #if !SILENT_TEST
2472      std::cout << std::endl;      std::cout << std::endl;
2473      #endif      #endif
# Line 2412  static void testBuiltInMaxFunction() { Line 2478  static void testBuiltInMaxFunction() {
2478      std::cout << "UNIT TEST: built-in max() function\n";      std::cout << "UNIT TEST: built-in max() function\n";
2479      #endif      #endif
2480    
2481        // integer tests ...
2482    
2483      runScript({      runScript({
2484          .code = R"NKSP_CODE(          .code = R"NKSP_CODE(
2485  on init  on init
# Line 2459  end on Line 2527  end on
2527          .expectIntExitResult = 4          .expectIntExitResult = 4
2528      });      });
2529    
2530        // real number tests ...
2531    
2532        runScript({
2533            .code = R"NKSP_CODE(
2534    on init
2535      declare $foo := max(1.0, 2.0)
2536      exit($foo)
2537    end on
2538    )NKSP_CODE",
2539            .expectRealExitResult = 2.0
2540        });
2541    
2542        runScript({
2543            .code = R"NKSP_CODE(
2544    on init
2545      declare $foo := max(-30.0, 4.0)
2546      exit($foo)
2547    end on
2548    )NKSP_CODE",
2549            .expectRealExitResult = 4.0
2550        });
2551    
2552        runScript({
2553            .code = R"NKSP_CODE(
2554    on init
2555      declare $foo := max(1.1, 1.13)
2556      exit($foo)
2557    end on
2558    )NKSP_CODE",
2559            .expectRealExitResult = 1.13
2560        });
2561    
2562        runScript({
2563            .code = R"NKSP_CODE(
2564    on init
2565      declare $foo := max(1.13, 1.1)
2566      exit($foo)
2567    end on
2568    )NKSP_CODE",
2569            .expectRealExitResult = 1.13
2570        });
2571    
2572        // mixed type tests ...
2573    
2574        runScript({
2575            .code = R"NKSP_CODE(
2576    on init
2577      declare $foo := max(1, 1.16)
2578      exit($foo)
2579    end on
2580    )NKSP_CODE",
2581            .expectRealExitResult = 1.16
2582        });
2583    
2584        runScript({
2585            .code = R"NKSP_CODE(
2586    on init
2587      declare $foo := max(-3.92, 9)
2588      exit($foo)
2589    end on
2590    )NKSP_CODE",
2591            .expectRealExitResult = 9.0
2592        });
2593    
2594      #if !SILENT_TEST      #if !SILENT_TEST
2595      std::cout << std::endl;      std::cout << std::endl;
2596      #endif      #endif
# Line 2487  end on Line 2619  end on
2619          .expectParseError = true // because abs() function requires 1 argument          .expectParseError = true // because abs() function requires 1 argument
2620      });      });
2621    
2622        // integer tests ...
2623    
2624      runScript({      runScript({
2625          .code = R"NKSP_CODE(          .code = R"NKSP_CODE(
2626  on init  on init
# Line 2507  end on Line 2641  end on
2641          .expectIntExitResult = 23          .expectIntExitResult = 23
2642      });      });
2643    
2644        // real number tests ...
2645    
2646        runScript({
2647            .code = R"NKSP_CODE(
2648    on init
2649      declare ~foo := abs(23.0)
2650      exit(~foo)
2651    end on
2652    )NKSP_CODE",
2653            .expectRealExitResult = 23.0
2654        });
2655    
2656        runScript({
2657            .code = R"NKSP_CODE(
2658    on init
2659      declare ~foo := abs(23.11)
2660      exit(~foo)
2661    end on
2662    )NKSP_CODE",
2663            .expectRealExitResult = 23.11
2664        });
2665    
2666        runScript({
2667            .code = R"NKSP_CODE(
2668    on init
2669      declare ~foo := abs(-23.11)
2670      exit(~foo)
2671    end on
2672    )NKSP_CODE",
2673            .expectRealExitResult = 23.11
2674        });
2675    
2676        runScript({
2677            .code = R"NKSP_CODE(
2678    on init
2679      declare ~bar := -23.11
2680      declare ~foo := abs(~bar)
2681      exit(~foo)
2682    end on
2683    )NKSP_CODE",
2684            .expectRealExitResult = 23.11
2685        });
2686    
2687      #if !SILENT_TEST      #if !SILENT_TEST
2688      std::cout << std::endl;      std::cout << std::endl;
2689      #endif      #endif

Legend:
Removed from v.3575  
changed lines
  Added in v.3577

  ViewVC Help
Powered by ViewVC