Eskil

Artifact [d203a42f72]
Login

Artifact d203a42f72a21afcdb7365ed5c25283f46cd272e:


#------------------------------------------------------------*- tcl -*-
# Tests for comparing blocks.
#----------------------------------------------------------------------

test blocks-1.1 {
    Change-block parsing
} -body {
    set b1 [list "Apa 1" "Bepa 1" "Cepa 1"]
    set b2 [list "Apa 2" "Bepa 2" "Cepa 2"]
    compareBlocks $b1 $b2
} -result {c c c}

test blocks-1.2 {
    Change-block parsing
} -body {
    set b1 [list "Apa 1" "Bepa 1"         "Cepa 1"]
    set b2 [list         "Bepa 2" "Gurka" "Cepa 2"]
    compareBlocks $b1 $b2
} -result {d c a c}

test blocks-1.3 {
    Change-block parsing
} -body {
    set b1 [list "Apa 1" "Bepa 1" "Cepa 1"]
    set b2 [list                  "Cepa 2" "Gurka"]
    compareBlocks $b1 $b2
} -result {d d c a}

test blocks-1.4 {
    Change-block parsing
} -body {
    set b1 [list "Apa 1" "Bepa 1" "Cepa 1"]
    set b2 [list         "Bepa 2" "Gurka"]
    compareBlocks $b1 $b2
} -result {d c C}

test blocks-1.5 {
    Change-block parsing
} -body {
    set b1 [list "Apa 1" "Bepa 1" "Cepa 1" "Depa 1"]
    set b2 [list         "Bepa 2" "Gurka"]
    compareBlocks $b1 $b2
} -result {d c C d}

test blocks-1.6 {
    Change-block parsing
} -body {
    set b1 [list "Apa 1" "Bepa 1"         "Cepa 1" "Depa 1"]
    set b2 [list         "Bepa 2" "Apa 2" "Cepa 2"]
    compareBlocks $b1 $b2
} -result {d c a c d}

# A big block
test blocks-1.7 {
    Change-block parsing
} -body {
    set b1 {a}
    set b2 {}
    for {set t 0} {$t < 40} {incr t} {
        lappend b1 $t
        lappend b2 $t
    }
    lappend b2 a
    compareBlocks $b1 $b2
} -result {d c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c a}

# This is designed to be complex enough to trigger the innermost loop
test blocks-1.8 {
    Change-block parsing, complex case
} -body {
    set b1 [list a 4              10    0 14 6 0 4 13 16 11]
    set b2 [list   3 1 7 12 11 17 10 15 0             16 a]
    compareBlocks $b1 $b2
} -result  [list d C a a a  a  a  c  a  c d  d d d d  c  C]


test blocks-2.1 {
    Troublesome real life example
} -body {
    set b1 [list \
            "   /* Reaction wheel motor currents and thermistors (not used in Pqwert)*/" \
            "   IrgIdRwlMotorCurr1," \
            "   IrgIdRwlTh1," \
            "   IrgIdRwlMotorCurr2," \
            "   IrgIdRwlTh2," \
            "   IrgIdRwlMotorCurr3," \
            "   IrgIdRwlTh3," \
            "   IrgIdRwlMotorCurr4," \
            "   IrgIdRwlTh4,"]
    set b2 [list \
            "   {0x00400908},   /* IrgIdRwlMotorCurr1 */  /* (not used in Pqwert) */" \
            "   {0x00400909},   /* IrgIdRwlTh1        */  /* (not used in Pqwert) */" \
            "   {0x00400D28},   /* IrgIdRwlMotorCurr2 */  /* (not used in Pqwert) */" \
            "   {0x00400D29},   /* IrgIdRwlTh2        */  /* (not used in Pqwert) */" \
            "   {0x00480908},   /* IrgIdRwlMotorCurr3 */  /* (not used in Pqwert) */" \
            "   {0x00480909},   /* IrgIdRwlTh3        */  /* (not used in Pqwert) */" \
            "   {0x00480D28},   /* IrgIdRwlMotorCurr4 */  /* (not used in Pqwert) */" \
            "   {0x00480D29},   /* IrgIdRwlTh4        */  /* (not used in Pqwert) */"]
    compareBlocks $b1 $b2
} -result [list d c c c c c c c c]

test blocks-2.2 {
    Troublesome real life example
} -constraints knownbug -body {
    set b1 [list \
            "  WrImmediate16 TME_TmEnCfg0 0563" \
            "  WrImmediate16 TME_TmEnCfg1 0212" \
            "  WrImmediate16 TME_TmIdCfg 0200" \
            "  WrImmediate32 TME_Bat0 21323130" \
            "  WrImmediate32 TME_Bat1 21323130" \
            "  WrImmediate32 TME_Bat2 21323130" \
            "  WrImmediate32 TME_Bat3 21323130" \
            "  WrImmediate32 TME_VcCfgA 00400FCA" \
            "  WrImmediate32 TME_VcCfgB 004007C1" \
            "  WrImmediate32 TME_VcCfgC 004007C1"]
    set b2 [list \
            "  WrImmediate16 TME_TmIdCfg 0204" \
            "  WrImmediate16 TME_VcCfgA 0FC7" \
            "  WrImmediate32 TME_VcCfgB 00400FC1" \
            "  WrImmediate32 TME_VcCfgC 00400FC1"]
    compareBlocks $b1 $b2
} -result [list d d c d d d d c c c]