Skip to content
Snippets Groups Projects
Select Git revision
  • 0726e13a5f3e4b32722cf4d3ef191c95d1110b34
  • master default protected
  • dev_2022
  • patch-1
  • develop
  • 50-use-ubuntus-libhidapi
  • issue-highLevelDispatch
  • issue-highLevelDesign
  • issue-motorStartBug
  • issue-commandLayerDesign
  • v1.0
  • v0.4-rc.13
  • v0.4-rc.12
  • v0.4-rc.11
  • v0.4-rc.10
  • v0.4-rc.9
  • v0.3-rc.8
  • v0.3-rc.7
  • v0.3-rc.6
  • v0.3-rc.5
  • v0.3-rc.4
  • v0.3-rc.3
  • v0.3-rc.2
  • v0.3-rc.1
  • v0.3-rc
  • v0.2
  • v0.1.1
  • v0.1
28 results

wfBrickIO.m

Blame
    • Tim Stadtmann's avatar
      912bb027
      Merge branch 'feature-display' · 912bb027
      Tim Stadtmann authored
      Implements overriden display-function and adapts comments to MATLAB's
      doc and help function in order to deliver a cleaner interface.
      Also, for some reason, all file-access modes in /source are marked as
      changed.
      912bb027
      History
      Merge branch 'feature-display'
      Tim Stadtmann authored
      Implements overriden display-function and adapts comments to MATLAB's
      doc and help function in order to deliver a cleaner interface.
      Also, for some reason, all file-access modes in /source are marked as
      changed.
    Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    Tests.fs 58.19 KiB
    module Tests
    
    #if INTERACTIVE
    #load "Interactive.fsx"
    #endif
    
    open NUnit.Framework
    open FsUnit
    open System.Collections.Generic
    open MathNet.Numerics
    open MathNet.Symbolics
    
    open Operators
    
    // Test: x should evaluate to expected
    let inline (-->) x expected = x |> should equal expected
    
    // Test: x should evaluate to the expected string when formatted *nicely*
    let inline (==>) x expected = Infix.format x |> should equal expected
    
    // Test: x should evaluate to the expected string when formatted *strictly* (not denormalized)
    let inline (===>) x expected = Infix.formatStrict x |> should equal expected
    
    // extra test helpers for tuples, list, arrays and hash-sets - maybe there's a better way?
    let inline (==|>) (x1, x2) expected = (Infix.format x1, Infix.format x2) |> should equal expected
    let inline (==||>) (x1, x2, x3) expected = (Infix.format x1, Infix.format x2, Infix.format x3) |> should equal expected
    let inline (==+>) x expected = List.iter2 (fun x e -> Infix.format x |> should equal e) x expected
    let inline (==->) x expected = Array.iter2 (fun x e -> Infix.format x |> should equal e) x expected
    let inline (==*>) (x:HashSet<Expression>) (expected:string list) = HashSet(expected).SetEquals(x |> Seq.map Infix.format) |> should be True
    
    // extra test helper for MathML (just normalizing XML, really)
    let inline (==/>) (x:string) expected = x |> should equal (Xml.normalizeString expected)
    
    // variables
    let x = symbol "x"
    let y = symbol "y"
    let z = symbol "z"
    let a = symbol "a"
    let b = symbol "b"
    let c = symbol "c"
    let d = symbol "d"
    let e = symbol "e"
    let f = symbol "f"
    
    [<Test>]
    let ``Number Expressions`` () =
    
        // equivalent:
        number 3 ==> "3"
        3Q ==> "3"
    
        // expressions are not comparable (NoComparison) to prevent errors,
        // but if the expressions are numbers we can use compareNumber:
        Numbers.compare 0Q 1Q --> -1
        Numbers.compare 1Q 1Q --> 0
        Numbers.compare 1Q 2Q --> -1
        Numbers.compare 0Q (1Q/2Q) --> -1
        Numbers.compare 1Q (1Q/2Q) --> 1
        Numbers.compare (1Q/2Q) 0Q --> 1
        Numbers.compare (1Q/2Q) 1Q --> -1
        Numbers.compare 1Q infinity --> -1
        Numbers.compare 1Q complexInfinity --> -1
        Numbers.compare 1Q negativeInfinity --> 1
        Numbers.compare infinity 1Q --> 1
        Numbers.compare complexInfinity 1Q --> 1
        Numbers.compare negativeInfinity 1Q --> -1
        Numbers.compare negativeInfinity infinity --> -1
        Numbers.compare infinity negativeInfinity --> 1
    
        Numbers.max [ 2Q; 4Q; 7Q/2 ] --> 4Q