text:
package org.scalatest

import org.scalactic.Equality
import org.scalactic.Uniformity
import org.scalactic.StringNormalizations._
import SharedHelpers._
import FailureMessages.decorateToStringValue
import Matchers._

class ListShouldContainInOrderOnlyLogicalAndSpec extends Spec {

  //ADDITIONAL//

  val invertedListOfStringEquality =
    new Equality[List[String]] {
      def areEqual(a: List[String], b: Any): Boolean = a != b
    }

  val upperCaseStringEquality =
    new Equality[String] {
      def areEqual(a: String, b: Any): Boolean = upperCase(a) == upperCase(b)
    }

  private def upperCase(value: Any): Any =
    value match {
      case l: List[_] => l.map(upperCase(_))
      case s: String => s.toUpperCase
      case c: Char => c.toString.toUpperCase.charAt(0)
      case (s1: String, s2: String) => (s1.toUpperCase, s2.toUpperCase)
      case e: java.util.Map.Entry[_, _] =>
        (e.getKey, e.getValue) match {
          case (k: String, v: String) => Entry(k.toUpperCase, v.toUpperCase)
          case _ => value
        }
      case _ => value
    }

  val upperCaseListOfStringEquality =
    new Equality[List[String]] {
      def areEqual(a: List[String], b: Any): Boolean = upperCase(a) == upperCase(b)
    }

  val fileName: String = "ListShouldContainInOrderOnlyLogicalAndSpec.scala"

  object `a List` {

    val fumList: List[String] = List("fum", "fum", "foe", "fie", "fie", "fee")
    val toList: List[String] = List("you", "you", "to", "birthday", "happy", "happy")

    object `when used with (contain inOrderOnly xx and contain inOrderOnly xx)` {

      def `should do nothing if valid, else throw a TFE with an appropriate error message` {
        fumList should (contain inOrderOnly ("fum", "foe", "fie", "fee") and contain inOrderOnly ("fum", "foe", "fie", "fee"))
        val e1 = intercept[TestFailedException] {
          fumList should (contain inOrderOnly ("fee", "fie", "foe", "fum") and contain inOrderOnly ("fum", "foe", "fie", "fee"))
        }
        checkMessageStackDepth(e1, Resources("didNotContainInOrderOnlyElements", decorateToStringValue(fumList), "\"fee\", \"fie\", \"foe\", \"fum\""), fileName, thisLineNumber - 2)
        val e2 = intercept[TestFailedException] {
          fumList should (contain inOrderOnly ("fum", "foe", "fie", "fee") and contain inOrderOnly ("fee", "fie", "foe", "fum"))
        }
        checkMessageStackDepth(e2, Resources("containedInOrderOnlyElements", decorateToStringValue(fumList), "\"fum\", \"foe\", \"fie\", \"fee\"") + ", but " + Resources("didNotContainInOrderOnlyElements", decorateToStringValue(fumList), "\"fee\", \"fie\", \"foe\", \"fum\""), fileName, thisLineNumber - 2)
      }

      def `should use the implicit Equality in scope` {
        implicit val ise = upperCaseStringEquality
        fumList should (contain inOrderOnly ("FUM", "FOE", "FIE", "FEE") and contain inOrderOnly ("FUM", "FOE", "FIE", "FEE"))
        val e1 = intercept[TestFailedException] {
          fumList should (contain inOrderOnly ("FEE", "FIE", "FOE", "FUM") and contain inOrderOnly ("FUM", "FOE", "FIE", "FEE"))
        }
        checkMessageStackDepth(e1, Resources("didNotContainInOrderOnlyElements", decorateToStringValue(fumList), "\"FEE\", \"FIE\", \"FOE\", \"FUM\""), fileName, thisLineNumber - 2)
        val e2 = intercept[TestFailedException] {
          fumList should (contain inOrderOnly ("FUM", "FOE", "FIE", "FEE") and (contain inOrderOnly ("FEE", "FIE", "FOE", "FUM")))
        }
        checkMessageStackDepth(e2, Resources("containedInOrderOnlyElements", decorateToStringValue(fumList), "\"FUM\", \"FOE\", \"FIE\", \"FEE\"") + ", but " + Resources("didNotContainInOrderOnlyElements", decorateToStringValue(fumList), "\"FEE\", \"FIE\", \"FOE\", \"FUM\""), fileName, thisLineNumber - 2)
      }

      def `should use an explicitly provided Equality` {
        (fumList should (contain inOrderOnly ("FUM", "FOE", "FIE", "FEE") and contain inOrderOnly ("FUM", "FOE", "FIE", "FEE"))) (decided by upperCaseStringEquality, decided by upperCaseStringEquality)
        val e1 = intercept[TestFailedException] {
          (fumList should (contain inOrderOnly ("FEE", "FIE", "FOE", "FUM") and contain inOrderOnly ("FUM", "FOE", "FIE", "FEE"))) (decided by upperCaseStringEquality, decided by upperCaseStringEquality)
        }
        checkMessageStackDepth(e1, Resources("didNotContainInOrderOnlyElements", decorateToStringValue(fumList), "\"FEE\", \"FIE\", \"FOE\", \"FUM\""), fileName, thisLineNumber - 2)
        val e2 = intercept[TestFailedException] {
          (fumList should (contain inOrderOnly ("FUM", "FOE", "FIE", "FEE") and contain inOrderOnly ("FEE", "FIE", "FOE", "FUM"))) (decided by upperCaseStringEquality, decided by upperCaseStringEquality)
        }
        checkMessageStackDepth(e2, Resources("containedInOrderOnlyElements", decorateToStringValue(fumList), "\"FUM\", \"FOE\", \"FIE\", \"FEE\"") + ", but " + Resources("didNotContainInOrderOnlyElements", decorateToStringValue(fumList), "\"FEE\", \"FIE\", \"FOE\", \"FUM\""), fileName, thisLineNumber - 2)
        (fumList should (contain inOrderOnly (" FUM ", " FOE ", " FIE ", " FEE ") and contain inOrderOnly (" FUM ", " FOE ", " FIE ", " FEE "))) (after being lowerCased and trimmed, after being lowerCased and trimmed)
      }

      def `should throw NotAllowedException with correct stack depth and message when RHS contain duplicated value` {
        val e1 = intercept[exceptions.NotAllowedException] {
          fumList should (contain inOrderOnly ("fee", "fie", "foe", "fie", "fum") and contain inOrderOnly ("fum", "foe", "fie", "fee"))
        }
        e1.failedCodeFileName.get should be (fileName)
        e1.failedCodeLineNumber.get should be (thisLineNumber - 3)
        e1.message should be (Some(Resources("inOrderOnlyDuplicate")))

        val e2 = intercept[exceptions.NotAllowedException] {
          fumList should (contain inOrderOnly ("fum", "foe", "fie", "fee") and contain inOrderOnly ("fee", "fie", "foe", "fie", "fum"))
        }
        e2.failedCodeFileName.get should be (fileName)
        e2.failedCodeLineNumber.get should be (thisLineNumber - 3)
        e2.message should be (Some(Resources("inOrderOnlyDuplicate")))
      }
    }

    object `when used with (equal xx and contain inOrderOnly xx)` {

      def `should do nothing if valid, else throw a TFE with an appropriate error message` {
        fumList should (equal (fumList) and contain inOrderOnly ("fum", "foe", "fie", "fee"))
        val e1 = intercept[TestFailedException] {
          fumList should (equal (toList) and contain inOrderOnly ("fum", "foe", "fie", "fee"))
        }
        checkMessageStackDepth(e1, Resources("didNotEqual", decorateToStringValue(fumList), decorateToStringValue(toList)), fileName, thisLineNumber - 2)
        val e2 = intercept[TestFailedException] {
          fumList should (equal (fumList) and contain inOrderOnly ("fee", "fie", "foe", "fum"))
        }
        checkMessageStackDepth(e2, Resources("equaled", decorateToStringValue(fumList), decorateToStringValue(fumList)) + ", but " + Resources("didNotContainInOrderOnlyElements", decorateToStringValue(fumList), "\"fee\", \"fie\", \"foe\", \"fum\""), fileName, thisLineNumber - 2)
      }

      def `should use the implicit Equality in scope` {
        implicit val ise = upperCaseStringEquality
        fumList should (equal (fumList) and contain inOrderOnly ("FUM", "FOE", "FIE", "FEE"))
        val e1 = intercept[TestFailedException] {
          fumList should (equal (toList) and contain inOrderOnly ("FUM", "FOE", "FIE", "FEE"))
        }
        checkMessageStackDepth(e1, Resources("didNotEqual", decorateToStringValue(fumList), decorateToStringValue(toList)), fileName, thisLineNumber - 2)
        val e2 = intercept[TestFailedException] {
          fumList should (equal (fumList) and (contain inOrderOnly ("FEE", "FIE", "FOE", "FAM")))
        }
        checkMessageStackDepth(e2, Resources("equaled", decorateToStringValue(fumList), decorateToStringValue(fumList)) + ", but " + Resources("didNotContainInOrderOnlyElements", decorateToStringValue(fumList), "\"FEE\", \"FIE\", \"FOE\", \"FAM\""), fileName, thisLineNumber - 2)
      }

      def `should use an explicitly provided Equality` {
        (fumList should (equal (toList) and contain inOrderOnly ("FUM", "FOE", "FIE", "FEE"))) (decided by invertedListOfStringEquality, decided by upperCaseStringEquality)
        val e1 = intercept[TestFailedException] {
          (fumList should (equal (toList) and contain inOrderOnly ("FEE", "FIE", "FOE", "FUM"))) (decided by invertedListOfStringEquality, decided by upperCaseStringEquality)
        }
        checkMessageStackDepth(e1, Resources("equaled", decorateToStringValue(fumList), decorateToStringValue(toList)) + ", but " + Resources("didNotContainInOrderOnlyElements", decorateToStringValue(fumList), "\"FEE\", \"FIE\", \"FOE\", \"FUM\""), fileName, thisLineNumber - 2)
        val e2 = intercept[TestFailedException] {
          (fumList should (equal (fumList) and contain inOrderOnly ("FUM", "FOE", "FIE", "FEE"))) (decided by invertedListOfStringEquality, decided by upperCaseStringEquality)
        }
        checkMessageStackDepth(e2, Resources("didNotEqual", decorateToStringValue(fumList), decorateToStringValue(fumList)), fileName, thisLineNumber - 2)
        (fumList should (equal (toList) and contain inOrderOnly (" FUM ", " FOE ", " FIE ", " FEE "))) (decided by invertedListOfStringEquality, after being lowerCased and trimmed)
      }

      def `should throw NotAllowedException with correct stack depth and message when RHS contain duplicated value` {
        val e1 = intercept[exceptions.NotAllowedException] {
          fumList should (equal (fumList) and contain inOrderOnly ("fee", "fie", "foe", "fie", "fum"))
        }
        e1.failedCodeFileName.get should be (fileName)
        e1.failedCodeLineNumber.get should be (thisLineNumber - 3)
        e1.message should be (Some(Resources("inOrderOnlyDuplicate")))
      }
    }

    object `when used with (be xx and contain inOrderOnly xx)` {

      def `should do nothing if valid, else throw a TFE with an appropriate error message` {
        fumList should (be_== (fumList) and contain inOrderOnly ("fum", "foe", "fie", "fee"))
        val e1 = intercept[TestFailedException] {
          fumList should (be_== (toList) and contain inOrderOnly ("fum", "foe", "fie", "fee"))
        }
        checkMessageStackDepth(e1, Resources("wasNotEqualTo", decorateToStringValue(fumList), decorateToStringValue(toList)), fileName, thisLineNumber - 2)
        val e2 = intercept[TestFailedException] {
          fumList should (be_== (fumList) and contain inOrderOnly ("fee", "fie", "foe", "fum"))
        }
        checkMessageStackDepth(e2, Resources("wasEqualTo", decorateToStringValue(fumList), decorateToStringValue(fumList)) + ", but " + Resources("didNotContainInOrderOnlyElements", decorateToStringValue(fumList), "\"fee\", \"fie\", \"foe\", \"fum\""), fileName, thisLineNumber - 2)
      }

      def `should use the implicit Equality in scope` {
        implicit val ise = upperCaseStringEquality
        fumList should (be_== (fumList) and contain inOrderOnly ("FUM", "FOE", "FIE", "FEE"))
        val e1 = intercept[TestFailedException] {
          fumList should (be_== (toList) and contain inOrderOnly ("FUM", "FOE", "FIE", "FEE"))
        }
        checkMessageStackDepth(e1, Resources("wasNotEqualTo", decorateToStringValue(fumList), decorateToStringValue(toList)), fileName, thisLineNumber - 2)
        val e2 = intercept[TestFailedException] {
          fumList should (be_== (fumList) and (contain inOrderOnly ("FEE", "FIE", "FOE", "FUM")))
        }
        checkMessageStackDepth(e2, Resources("wasEqualTo", decorateToStringValue(fumList), decorateToStringValue(fumList)) + ", but " + Resources("didNotContainInOrderOnlyElements", decorateToStringValue(fumList), "\"FEE\", \"FIE\", \"FOE\", \"FUM\""), fileName, thisLineNumber - 2)
      }

      def `should use an explicitly provided Equality` {
        (fumList should (be_== (fumList) and contain inOrderOnly ("FUM", "FOE", "FIE", "FEE"))) (decided by upperCaseStringEquality)
        val e1 = intercept[TestFailedException] {
          (fumList should (be_== (fumList) and contain inOrderOnly ("FEE", "FIE", "FOE", "FUM"))) (decided by upperCaseStringEquality)
        }
        checkMessageStackDepth(e1, Resources("wasEqualTo", decorateToStringValue(fumList), decorateToStringValue(fumList)) + ", but " + Resources("didNotContainInOrderOnlyElements", decorateToStringValue(fumList), "\"FEE\", \"FIE\", \"FOE\", \"FUM\""), fileName, thisLineNumber - 2)
        val e2 = intercept[TestFailedException] {
          (fumList should (be_== (toList) and contain inOrderOnly ("FUM", "FOE", "FIE", "FEE"))) (decided by upperCaseStringEquality)
        }
        checkMessageStackDepth(e2, Resources("wasNotEqualTo", decorateToStringValue(fumList), decorateToStringValue(toList)), fileName, thisLineNumber - 2)
        (fumList should (be_== (fumList) and contain inOrderOnly (" FUM ", " FOE ", " FIE ", " FEE "))) (after being lowerCased and trimmed)
      }

      def `should throw NotAllowedException with correct stack depth and message when RHS contain duplicated value` {
        val e1 = intercept[exceptions.NotAllowedException] {
          fumList should (be_== (fumList) and contain inOrderOnly ("fee", "fie", "foe", "fie", "fum"))
        }
        e1.failedCodeFileName.get should be (fileName)
        e1.failedCodeLineNumber.get should be (thisLineNumber - 3)
        e1.message should be (Some(Resources("inOrderOnlyDuplicate")))
      }
    }

    object `when used with (contain inOrderOnly xx and be xx)` {

      def `should do nothing if valid, else throw a TFE with an appropriate error message` {
        fumList should (contain inOrderOnly ("fum", "foe", "fie", "fee") and be_== (fumList))
        val e1 = intercept[TestFailedException] {
          fumList should (contain inOrderOnly ("fum", "foe", "fie", "fee") and be_== (toList))
        }
        checkMessageStackDepth(e1, Resources("containedInOrderOnlyElements", decorateToStringValue(fumList), "\"fum\", \"foe\", \"fie\", \"fee\"") + ", but " + Resources("wasNotEqualTo", decorateToStringValue(fumList), decorateToStringValue(toList)), fileName, thisLineNumber - 2)
        val e2 = intercept[TestFailedException] {
          fumList should (contain inOrderOnly ("fee", "fie", "foe", "fum") and be_== (fumList))
        }
        checkMessageStackDepth(e2, Resources("didNotContainInOrderOnlyElements", decorateToStringValue(fumList), "\"fee\", \"fie\", \"foe\", \"fum\""), fileName, thisLineNumber - 2)
      }

      def `should use the implicit Equality in scope` {
        implicit val ise = upperCaseStringEquality
        fumList should (contain inOrderOnly ("FUM", "FOE", "FIE", "FEE") and be_== (fumList))
        val e1 = intercept[TestFailedException] {
          fumList should (contain inOrderOnly ("FEE", "FIE", "FOE", "FUM") and be_== (toList))
        }
        checkMessageStackDepth(e1, Resources("didNotContainInOrderOnlyElements", decorateToStringValue(fumList), "\"FEE\", \"FIE\", \"FOE\", \"FUM\""), fileName, thisLineNumber - 2)
        val e2 = intercept[TestFailedException] {
          fumList should (contain inOrderOnly ("HAPPY", "BIRTHDAY", "TO", "YOU") and (be_== (fumList)))
        }
        checkMessageStackDepth(e2, Resources("didNotContainInOrderOnlyElements", decorateToStringValue(fumList), "\"HAPPY\", \"BIRTHDAY\", \"TO\", \"YOU\""), fileName, thisLineNumber - 2)
      }

      def `should use an explicitly provided Equality` {
        (fumList should (contain inOrderOnly ("FUM", "FOE", "FIE", "FEE") and be_== (fumList))) (decided by upperCaseStringEquality)
        val e1 = intercept[TestFailedException] {
          (fumList should (contain inOrderOnly ("FEE", "FIE", "FOE", "FUM") and be_== (fumList))) (decided by upperCaseStringEquality)
        }
        checkMessageStackDepth(e1, Resources("didNotContainInOrderOnlyElements", decorateToStringValue(fumList), "\"FEE\", \"FIE\", \"FOE\", \"FUM\""), fileName, thisLineNumber - 2)
        val e2 = intercept[TestFailedException] {
          (fumList should (contain inOrderOnly ("FUM", "FOE", "FIE", "FEE") and be_== (toList))) (decided by upperCaseStringEquality)
        }
        checkMessageStackDepth(e2, Resources("containedInOrderOnlyElements", decorateToStringValue(fumList), "\"FUM\", \"FOE\", \"FIE\", \"FEE\"") + ", but " + Resources("wasNotEqualTo", decorateToStringValue(fumList), decorateToStringValue(toList)), fileName, thisLineNumber - 2)
        (fumList should (contain inOrderOnly (" FUM ", " FOE ", " FIE ", " FEE ") and be_== (fumList))) (after being lowerCased and trimmed)
      }

      def `should throw NotAllowedException with correct stack depth and message when RHS contain duplicated value` {
        val e1 = intercept[exceptions.NotAllowedException] {
          fumList should (contain inOrderOnly ("fee", "fie", "foe", "fie", "fum") and be_== (fumList))
        }
        e1.failedCodeFileName.get should be (fileName)
        e1.failedCodeLineNumber.get should be (thisLineNumber - 3)
        e1.message should be (Some(Resources("inOrderOnlyDuplicate")))
      }
    }

    object `when used with (not contain inOrderOnly xx and not contain inOrderOnly xx)` {

      def `should do nothing if valid, else throw a TFE with an appropriate error message` {
        fumList should (not contain inOrderOnly ("fee", "fie", "foe", "fum") and not contain inOrderOnly ("fee", "fie", "foe", "fum"))
        val e1 = intercept[TestFailedException] {
          fumList should (not contain inOrderOnly ("fum", "foe", "fie", "fee") and not contain inOrderOnly ("happy", "birthday", "to", "you"))
        }
        checkMessageStackDepth(e1, Resources("containedInOrderOnlyElements", decorateToStringValue(fumList), "\"fum\", \"foe\", \"fie\", \"fee\""), fileName, thisLineNumber - 2)
        val e2 = intercept[TestFailedException] {
          fumList should (not contain inOrderOnly ("fee", "fie", "foe", "fum") and not contain inOrderOnly ("fum", "foe", "fie", "fee"))
        }
        checkMessageStackDepth(e2, Resources("didNotContainInOrderOnlyElements", decorateToStringValue(fumList), "\"fee\", \"fie\", \"foe\", \"fum\"") + ", but " + Resources("containedInOrderOnlyElements", decorateToStringValue(fumList), "\"fum\", \"foe\", \"fie\", \"fee\""), fileName, thisLineNumber - 2)
      }

      def `should use the implicit Equality in scope` {
        implicit val ise = upperCaseStringEquality
        fumList should (not contain inOrderOnly ("FEE", "FIE", "FOE", "FUM") and not contain inOrderOnly ("FEE", "FIE", "FOE", "FUM"))
        val e1 = intercept[TestFailedException] {
          fumList should (not contain inOrderOnly ("FUM", "FOE", "FIE", "FEE") and not contain inOrderOnly ("FEE", "FIE", "FOE", "FUM"))
        }
        checkMessageStackDepth(e1, Resources("containedInOrderOnlyElements", decorateToStringValue(fumList), "\"FUM\", \"FOE\", \"FIE\", \"FEE\""), fileName, thisLineNumber - 2)
        val e2 = intercept[TestFailedException] {
          fumList should (not contain inOrderOnly ("FEE", "FIE", "FOE", "FUM") and (not contain inOrderOnly ("FUM", "FOE", "FIE", "FEE")))
        }
        checkMessageStackDepth(e2, Resources("didNotContainInOrderOnlyElements", decorateToStringValue(fumList), "\"FEE\", \"FIE\", \"FOE\", \"FUM\"") + ", but " + Resources("containedInOrderOnlyElements", decorateToStringValue(fumList), "\"FUM\", \"FOE\", \"FIE\", \"FEE\""), fileName, thisLineNumber - 2)
      }

      def `should use an explicitly provided Equality` {
        (fumList should (not contain inOrderOnly ("FEE", "FIE", "FOE", "FUM") and not contain inOrderOnly ("FEE", "FIE", "FOE", "FUM"))) (decided by upperCaseStringEquality, decided by upperCaseStringEquality)
        val e1 = intercept[TestFailedException] {
          (fumList should (not contain inOrderOnly ("FEE", "FIE", "FOE", "FUM") and not contain inOrderOnly ("FUM", "FOE", "FIE", "FEE"))) (decided by upperCaseStringEquality, decided by upperCaseStringEquality)
        }
        checkMessageStackDepth(e1, Resources("didNotContainInOrderOnlyElements", decorateToStringValue(fumList), "\"FEE\", \"FIE\", \"FOE\", \"FUM\"") + ", but " + Resources("containedInOrderOnlyElements", decorateToStringValue(fumList), "\"FUM\", \"FOE\", \"FIE\", \"FEE\""), fileName, thisLineNumber - 2)
        val e2 = intercept[TestFailedException] {
          (fumList should (not contain inOrderOnly ("FUM", "FOE", "FIE", "FEE") and not contain inOrderOnly ("FEE", "FIE", "FOE", "FUM"))) (decided by upperCaseStringEquality, decided by upperCaseStringEquality)
        }
        checkMessageStackDepth(e2, Resources("containedInOrderOnlyElements", decorateToStringValue(fumList), "\"FUM\", \"FOE\", \"FIE\", \"FEE\""), fileName, thisLineNumber - 2)
      }

      def `should throw NotAllowedException with correct stack depth and message when RHS contain duplicated value` {
        val e1 = intercept[exceptions.NotAllowedException] {
          fumList should (not contain inOrderOnly ("fee", "fie", "foe", "fie", "fum") and not contain inOrderOnly ("fee", "fie", "foe", "fum"))
        }
        e1.failedCodeFileName.get should be (fileName)
        e1.failedCodeLineNumber.get should be (thisLineNumber - 3)
        e1.message should be (Some(Resources("inOrderOnlyDuplicate")))

        val e2 = intercept[exceptions.NotAllowedException] {
          fumList should (not contain inOrderOnly ("fee", "fie", "foe", "fum") and not contain inOrderOnly ("fee", "fie", "foe", "fie", "fum"))
        }
        e2.failedCodeFileName.get should be (fileName)
        e2.failedCodeLineNumber.get should be (thisLineNumber - 3)
        e2.message should be (Some(Resources("inOrderOnlyDuplicate")))
      }
    }

    object `when used with (not equal xx and not contain inOrderOnly xx)` {

      def `should do nothing if valid, else throw a TFE with an appropriate error message` {
        fumList should (not equal (toList) and not contain inOrderOnly ("fee", "fie", "foe", "fum"))
        val e1 = intercept[TestFailedException] {
          fumList should (not equal (fumList) and not contain inOrderOnly ("fee", "fie", "foe", "fum"))
        }
        checkMessageStackDepth(e1, Resources("equaled", decorateToStringValue(fumList), decorateToStringValue(fumList)), fileName, thisLineNumber - 2)
        val e2 = intercept[TestFailedException] {
          fumList should (not equal (toList) and not contain inOrderOnly ("fum", "foe", "fie", "fee"))
        }
        checkMessageStackDepth(e2, Resources("didNotEqual", decorateToStringValue(fumList), decorateToStringValue(toList)) + ", but " + Resources("containedInOrderOnlyElements", decorateToStringValue(fumList), "\"fum\", \"foe\", \"fie\", \"fee\""), fileName, thisLineNumber - 2)
      }

      def `should use the implicit Equality in scope` {
        implicit val ise = upperCaseStringEquality
        fumList should (not equal (toList) and not contain inOrderOnly ("FEE", "FIE", "FOE", "FUM"))
        val e1 = intercept[TestFailedException] {
          fumList should (not equal (fumList) and not contain inOrderOnly ("FEE", "FIE", "FOE", "FUM"))
        }
        checkMessageStackDepth(e1, Resources("equaled", decorateToStringValue(fumList), decorateToStringValue(fumList)), fileName, thisLineNumber - 2)
        val e2 = intercept[TestFailedException] {
          fumList should (not equal (toList) and (not contain inOrderOnly ("FUM", "FOE", "FIE", "FEE")))
        }
        checkMessageStackDepth(e2, Resources("didNotEqual", decorateToStringValue(fumList), decorateToStringValue(toList)) + ", but " + Resources("containedInOrderOnlyElements", decorateToStringValue(fumList), "\"FUM\", \"FOE\", \"FIE\", \"FEE\""), fileName, thisLineNumber - 2)
      }

      def `should use an explicitly provided Equality` {
        (fumList should (not equal (fumList) and not contain inOrderOnly ("FEE", "FIE", "FOE", "FUM"))) (decided by invertedListOfStringEquality, decided by upperCaseStringEquality)
        val e1 = intercept[TestFailedException] {
          (fumList should (not equal (fumList) and not contain inOrderOnly ("FUM", "FOE", "FIE", "FEE"))) (decided by invertedListOfStringEquality, decided by upperCaseStringEquality)
        }
        checkMessageStackDepth(e1, Resources("didNotEqual", decorateToStringValue(fumList), decorateToStringValue(fumList)) + ", but " + Resources("containedInOrderOnlyElements", decorateToStringValue(fumList), "\"FUM\", \"FOE\", \"FIE\", \"FEE\""), fileName, thisLineNumber - 2)
        val e2 = intercept[TestFailedException] {
          (fumList should (not equal (toList) and not contain inOrderOnly ("FEE", "FIE", "FOE", "FUM"))) (decided by invertedListOfStringEquality, decided by upperCaseStringEquality)
        }
        checkMessageStackDepth(e2, Resources("equaled", decorateToStringValue(fumList), decorateToStringValue(toList)), fileName, thisLineNumber - 2)
      }

      def `should throw NotAllowedException with correct stack depth and message when RHS contain duplicated value` {
        val e1 = intercept[exceptions.NotAllowedException] {
          fumList should (not equal (toList) and not contain inOrderOnly ("fee", "fie", "foe", "fie", "fum"))
        }
        e1.failedCodeFileName.get should be (fileName)
        e1.failedCodeLineNumber.get should be (thisLineNumber - 3)
        e1.message should be (Some(Resources("inOrderOnlyDuplicate")))
      }
    }

    object `when used with (not be xx and not contain inOrderOnly xx)` {

      def `should do nothing if valid, else throw a TFE with an appropriate error message` {
        fumList should (not be_== (toList) and not contain inOrderOnly ("fee", "fie", "foe", "fum"))
        val e1 = intercept[TestFailedException] {
          fumList should (not be_== (fumList) and not contain inOrderOnly ("fee", "fie", "foe", "fum"))
        }
        checkMessageStackDepth(e1, Resources("wasEqualTo", decorateToStringValue(fumList), decorateToStringValue(fumList)), fileName, thisLineNumber - 2)
        val e2 = intercept[TestFailedException] {
          fumList should (not be_== (toList) and not contain inOrderOnly ("fum", "foe", "fie", "fee"))
        }
        checkMessageStackDepth(e2, Resources("wasNotEqualTo", decorateToStringValue(fumList), decorateToStringValue(toList)) + ", but " + Resources("containedInOrderOnlyElements", decorateToStringValue(fumList), "\"fum\", \"foe\", \"fie\", \"fee\""), fileName, thisLineNumber - 2)
      }

      def `should use the implicit Equality in scope` {
        implicit val ise = upperCaseStringEquality
        fumList should (not be_== (toList) and not contain inOrderOnly ("FEE", "FIE", "FOE", "FUM"))
        val e1 = intercept[TestFailedException] {
          fumList should (not be_== (fumList) and not contain inOrderOnly ("FEE", "FIE", "FOE", "FUM"))
        }
        checkMessageStackDepth(e1, Resources("wasEqualTo", decorateToStringValue(fumList), decorateToStringValue(fumList)), fileName, thisLineNumber - 2)
        val e2 = intercept[TestFailedException] {
          fumList should (not be_== (toList) and (not contain inOrderOnly ("FUM", "FOE", "FIE", "FEE")))
        }
        checkMessageStackDepth(e2, Resources("wasNotEqualTo", decorateToStringValue(fumList), decorateToStringValue(toList)) + ", but " + Resources("containedInOrderOnlyElements", decorateToStringValue(fumList), "\"FUM\", \"FOE\", \"FIE\", \"FEE\""), fileName, thisLineNumber - 2)
      }

      def `should use an explicitly provided Equality` {
        (fumList should (not be_== (toList) and not contain inOrderOnly ("FEE", "FIE", "FOE", "FUM"))) (decided by upperCaseStringEquality)
        val e1 = intercept[TestFailedException] {
          (fumList should (not be_== (toList) and not contain inOrderOnly ("FUM", "FOE", "FIE", "FEE"))) (decided by upperCaseStringEquality)
        }
        checkMessageStackDepth(e1, Resources("wasNotEqualTo", decorateToStringValue(fumList), decorateToStringValue(toList)) + ", but " + Resources("containedInOrderOnlyElements", decorateToStringValue(fumList), "\"FUM\", \"FOE\", \"FIE\", \"FEE\""), fileName, thisLineNumber - 2)
        val e2 = intercept[TestFailedException] {
          (fumList should (not be_== (fumList) and not contain inOrderOnly ("FEE", "FIE", "FOE", "FUM"))) (decided by upperCaseStringEquality)
        }
        checkMessageStackDepth(e2, Resources("wasEqualTo", decorateToStringValue(fumList), decorateToStringValue(fumList)), fileName, thisLineNumber - 2)
        (fumList should (not contain inOrderOnly (" FEE ", " FIE ", " FOE ", " FUU ") and not contain inOrderOnly (" FEE ", " FIE ", " FOE ", " FUU "))) (after being lowerCased and trimmed, after being lowerCased and trimmed)
      }

      def `should throw NotAllowedException with correct stack depth and message when RHS contain duplicated value` {
        val e1 = intercept[exceptions.NotAllowedException] {
          fumList should (not be_== (toList) and not contain inOrderOnly ("fee", "fie", "foe", "fie", "fum"))
        }
        e1.failedCodeFileName.get should be (fileName)
        e1.failedCodeLineNumber.get should be (thisLineNumber - 3)
        e1.message should be (Some(Resources("inOrderOnlyDuplicate")))
      }
    }
  }

  object `col of Lists` {

    val list1s: Vector[List[Int]] = Vector(List(1, 2, 2, 3), List(1, 2, 2, 3), List(1, 2, 2, 3))
    val lists: Vector[List[Int]] = Vector(List(1, 2, 3, 3), List(1, 2, 3, 3), List(2, 3, 4))
    val nils: Vector[List[Int]] = Vector(Nil, Nil, Nil)
    val listsNil: Vector[List[Int]] = Vector(List(1, 2, 3), List(1, 2, 3), Nil)
    val hiLists: Vector[List[String]] = Vector(List("hi", "hello"), List("hi", "hello"), List("hi", "hello"))

    def allErrMsg(index: Int, message: String, lineNumber: Int, left: Any): String =
      "'all' inspection failed, because: \n" +
      "  at index " + index + ", " + message + " (" + fileName + ":" + (lineNumber) + ") \n" +
      "in " + decorateToStringValue(left)

    object `used with contain inOrderOnly xx and contain inOrderOnly xx` {

      def `should do nothing if valid, else throw a TFE with an appropriate error message` {
        all (list1s) should (contain inOrderOnly (1, 2, 3) and contain inOrderOnly (1, 2, 3))
        atLeast (2, lists) should (contain inOrderOnly (1, 2, 3) and contain inOrderOnly (1, 2, 3))
        atMost (2, lists) should (contain inOrderOnly (1, 2, 3) and contain inOrderOnly (1, 2, 3))
        no (lists) should (contain inOrderOnly (3, 6, 9) and contain inOrderOnly (3, 4, 5))
        no (nils) should (contain inOrderOnly (1, 2, 8) and contain inOrderOnly (1, 3, 4))
        no (listsNil) should (contain inOrderOnly (3, 8, 5) and contain inOrderOnly (3, 4, 5))

        val e1 = intercept[TestFailedException] {
          all (lists) should (contain inOrderOnly (1, 2, 3) and contain inOrderOnly (1, 2, 3))
        }
        checkMessageStackDepth(e1, allErrMsg(2, decorateToStringValue(List(2, 3, 4)) + " did not contain only " + "(1, 2, 3)" + " in order", thisLineNumber - 2, lists), fileName, thisLineNumber - 2)

        val e2 = intercept[TestFailedException] {
          all (list1s) should (contain inOrderOnly (1, 2, 3) and contain inOrderOnly (1, 3, 4))
        }
        checkMessageStackDepth(e2, allErrMsg(0, decorateToStringValue(List(1, 2, 2, 3)) + " contained only " + "(1, 2, 3)" + " in order" + ", but " + decorateToStringValue(List(1, 2, 2, 3)) + " did not contain only " + "(1, 3, 4)" + " in order", thisLineNumber - 2, list1s), fileName, thisLineNumber - 2)

        val e3 = intercept[TestFailedException] {
          all (nils) should (contain inOrderOnly ("hi", "hello") and contain inOrderOnly ("ho", "hey", "howdy"))
        }
        checkMessageStackDepth(e3, allErrMsg(0, decorateToStringValue(nils(0)) + " did not contain only " + "(\"hi\", \"hello\")" + " in order", thisLineNumber - 2, nils), fileName, thisLineNumber - 2)

        val e4 = intercept[TestFailedException] {
          all (hiLists) should (contain inOrderOnly ("hi", "hello") and contain inOrderOnly ("hello", "hi"))
        }
        checkMessageStackDepth(e4, allErrMsg(0, decorateToStringValue(List("hi", "hello")) + " contained only " + "(\"hi\", \"hello\")" + " in order" + ", but " + decorateToStringValue(List("hi", "hello")) + " did not contain only " + "(\"hello\", \"hi\")" + " in order", thisLineNumber - 2, hiLists), fileName, thisLineNumber - 2)
      }

      def `should use the implicit Equality in scope` {
        implicit val ise = upperCaseStringEquality

        all (hiLists) should (contain inOrderOnly ("HI", "HELLO") and contain inOrderOnly ("HI", "HELLO"))

        val e1 = intercept[TestFailedException] {
          all (hiLists) should (contain inOrderOnly ("HO", "HELLO") and contain inOrderOnly ("HI", "HELLO"))
        }
        checkMessageStackDepth(e1, allErrMsg(0, decorateToStringValue(List("hi", "hello")) + " did not contain only " + "(\"HO\", \"HELLO\")" + " in order", thisLineNumber - 2, hiLists), fileName, thisLineNumber - 2)

        val e2 = intercept[TestFailedException] {
          all (hiLists) should (contain inOrderOnly ("HI", "HELLO") and contain inOrderOnly ("HELLO", "HI"))
        }
        checkMessageStackDepth(e2, allErrMsg(0, decorateToStringValue(List("hi", "hello")) + " contained only " + "(\"HI\", \"HELLO\")" + " in order" + ", but " + decorateToStringValue(List("hi", "hello")) + " did not contain only " + "(\"HELLO\", \"HI\")" + " in order", thisLineNumber - 2, hiLists), fileName, thisLineNumber - 2)
      }

      def `should use an explicitly provided Equality` {
        (all (hiLists) should (contain inOrderOnly ("HI", "HELLO") and contain inOrderOnly ("HI", "HELLO"))) (decided by upperCaseStringEquality, decided by upperCaseStringEquality)
        val e1 = intercept[TestFailedException] {
          (all (hiLists) should (contain inOrderOnly ("HO", "HELLO") and contain inOrderOnly ("HI", "HELLO"))) (decided by upperCaseStringEquality, decided by upperCaseStringEquality)
        }
        checkMessageStackDepth(e1, allErrMsg(0, decorateToStringValue(List("hi", "hello")) + " did not contain only " + "(\"HO\", \"HELLO\")" + " in order", thisLineNumber - 2, hiLists), fileName, thisLineNumber - 2)

        val e2 = intercept[TestFailedException] {
          (all (hiLists) should (contain inOrderOnly ("HI", "HELLO") and contain inOrderOnly ("HELLO", "HI"))) (decided by upperCaseStringEquality, decided by upperCaseStringEquality)
        }
        checkMessageStackDepth(e2, allErrMsg(0, decorateToStringValue(List("hi", "hello")) + " contained only " + "(\"HI\", \"HELLO\")" + " in order" + ", but " + decorateToStringValue(List("hi", "hello")) + " did not contain only " + "(\"HELLO\", \"HI\")" + " in order", thisLineNumber - 2, hiLists), fileName, thisLineNumber - 2)
      }

      def `should throw NotAllowedException with correct stack depth and message when RHS contain duplicated value` {
        val e1 = intercept[exceptions.NotAllowedException] {
          all (list1s) should (contain inOrderOnly (1, 2, 2, 3) and contain inOrderOnly (1, 2, 3))
        }
        e1.failedCodeFileName.get should be (fileName)
        e1.failedCodeLineNumber.get should be (thisLineNumber - 3)
        e1.message should be (Some(Resources("inOrderOnlyDuplicate")))

        val e2 = intercept[exceptions.NotAllowedException] {
          all (list1s) should (contain inOrderOnly (1, 2, 3) and contain inOrderOnly (1, 2, 2, 3))
        }
        e2.failedCodeFileName.get should be (fileName)
        e2.failedCodeLineNumber.get should be (thisLineNumber - 3)
        e2.message should be (Some(Resources("inOrderOnlyDuplicate")))
      }
    }

    object `when used with (be xx and contain inOrderOnly xx)` {

      def `should do nothing if valid, else throw a TFE with an appropriate error message` {
        all (list1s) should (be_== (List(1, 2, 2, 3)) and contain inOrderOnly (1, 2, 3))
        atLeast (2, lists) should (be_== (List(1, 2, 3, 3)) and contain inOrderOnly (1, 2, 3))
        atMost (2, lists) should (be_== (List(3, 2, 1)) and contain inOrderOnly (1, 2, 3))
        no (lists) should (be_== (List(3, 6, 9)) and contain inOrderOnly (3, 4, 5))
        no (nils) should (be_== (List(1, 6, 8)) and contain inOrderOnly (1, 3, 4))
        no (listsNil) should (be_== (List(2, 6, 8)) and contain inOrderOnly (3, 4, 5))

        val e1 = intercept[TestFailedException] {
          all (lists) should (be_== (List(1, 2, 3, 3)) and contain inOrderOnly (1, 2, 3))
        }
        checkMessageStackDepth(e1, allErrMsg(2, decorateToStringValue(List(2, 3, 4)) + " was not equal to " + decorateToStringValue(List(1, 2, 3, 3)), thisLineNumber - 2, lists), fileName, thisLineNumber - 2)

        val e2 = intercept[TestFailedException] {
          all (list1s) should (be_== (List(1, 2, 2, 3)) and contain inOrderOnly (2, 3, 8))
        }
        checkMessageStackDepth(e2, allErrMsg(0, decorateToStringValue(List(1, 2, 2, 3)) + " was equal to " + decorateToStringValue(List(1, 2, 2, 3)) + ", but " + decorateToStringValue(List(1, 2, 2, 3)) + " did not contain only " + "(2, 3, 8)" + " in order", thisLineNumber - 2, list1s), fileName, thisLineNumber - 2)

        val e3 = intercept[TestFailedException] {
          all (nils) should (be_== (List("hey")) and contain inOrderOnly ("hi", "hello"))
        }
        checkMessageStackDepth(e3, allErrMsg(0, decorateToStringValue(nils(0)) + " was not equal to " + decorateToStringValue(List("hey")), thisLineNumber - 2, nils), fileName, thisLineNumber - 2)

        val e4 = intercept[TestFailedException] {
          all (hiLists) should (be_== (List("hi", "hello")) and contain inOrderOnly ("hello", "hi"))
        }
        checkMessageStackDepth(e4, allErrMsg(0, decorateToStringValue(List("hi", "hello")) + " was equal to " + decorateToStringValue(List("hi", "hello")) + ", but " + decorateToStringValue(List("hi", "hello")) + " did not contain only " + "(\"hello\", \"hi\")" + " in order", thisLineNumber - 2, hiLists), fileName, thisLineNumber - 2)

        val e5 = intercept[TestFailedException] {
          all (listsNil) should (be_== (List(1, 2, 3)) and contain inOrderOnly (1, 2, 3))
        }
        checkMessageStackDepth(e5, allErrMsg(2, decorateToStringValue(listsNil(2)) + " was not equal to " + decorateToStringValue(List(1, 2, 3)), thisLineNumber - 2, listsNil), fileName, thisLineNumber - 2)

        val e6 = intercept[TestFailedException] {
          all (list1s) should (be_== (List(1, 2, 2, 3)) and contain inOrderOnly (2, 3, 8))
        }
        checkMessageStackDepth(e6, allErrMsg(0, decorateToStringValue(List(1, 2, 2, 3)) + " was equal to " + decorateToStringValue(List(1, 2, 2, 3)) + ", but " + decorateToStringValue(List(1, 2, 2, 3)) + " did not contain only " + "(2, 3, 8)" + " in order", thisLineNumber - 2, list1s), fileName, thisLineNumber - 2)
      }

      def `should use the implicit Equality in scope` {
        implicit val ise = upperCaseStringEquality

        all (hiLists) should (be_== (List("hi", "hello")) and contain inOrderOnly ("HI", "HELLO"))

        val e1 = intercept[TestFailedException] {
          all (hiLists) should (be_== (List("HI", "HELLO")) and contain inOrderOnly ("HI", "HELLO"))
        }
        checkMessageStackDepth(e1, allErrMsg(0, decorateToStringValue(List("hi", "hello")) + " was not equal to " + decorateToStringValue(List("HI", "HELLO")), thisLineNumber - 2, hiLists), fileName, thisLineNumber - 2)

        val e2 = intercept[TestFailedException] {
          all (hiLists) should (be_== (List("hi", "hello")) and contain inOrderOnly ("HELLO", "HI"))
        }
        checkMessageStackDepth(e2, allErrMsg(0, decorateToStringValue(List("hi", "hello")) + " was equal to " + decorateToStringValue(List("hi", "hello")) + ", but " + decorateToStringValue(List("hi", "hello")) + " did not contain only " + "(\"HELLO\", \"HI\")" + " in order", thisLineNumber - 2, hiLists), fileName, thisLineNumber - 2)
      }

      def `should use an explicitly provided Equality` {
        (all (hiLists) should (be_== (List("hi", "hello")) and contain inOrderOnly ("HI", "HELLO"))) (decided by upperCaseStringEquality)
        val e1 = intercept[TestFailedException] {
          (all (hiLists) should (be_== (List("HI", "HELLO")) and contain inOrderOnly ("HI", "HELLO"))) (decided by upperCaseStringEquality)
        }
        checkMessageStackDepth(e1, allErrMsg(0, decorateToStringValue(List("hi", "hello")) + " was not equal to " + decorateToStringValue(List("HI", "HELLO")), thisLineNumber - 2, hiLists), fileName, thisLineNumber - 2)

        val e2 = intercept[TestFailedException] {
          (all (hiLists) should (be_== (List("hi", "hello")) and contain inOrderOnly ("HELLO", "HI"))) (decided by upperCaseStringEquality)
        }
        checkMessageStackDepth(e2, allErrMsg(0, decorateToStringValue(List("hi", "hello")) + " was equal to " + decorateToStringValue(List("hi", "hello")) + ", but " + decorateToStringValue(List("hi", "hello")) + " did not contain only " + "(\"HELLO\", \"HI\")" + " in order", thisLineNumber - 2, hiLists), fileName, thisLineNumber - 2)
      }

      def `should throw NotAllowedException with correct stack depth and message when RHS contain duplicated value` {
        val e1 = intercept[exceptions.NotAllowedException] {
          all (list1s) should (be_== (List(1, 2, 2, 3)) and contain inOrderOnly (1, 2, 2, 3))
        }
        e1.failedCodeFileName.get should be (fileName)
        e1.failedCodeLineNumber.get should be (thisLineNumber - 3)
        e1.message should be (Some(Resources("inOrderOnlyDuplicate")))
      }
    }

    object `when used with (not contain inOrderOnly xx and not contain inOrderOnly xx)` {

      def `should do nothing if valid, else throw a TFE with an appropriate error message` {
        all (list1s) should (not contain inOrderOnly (3, 2, 8) and not contain inOrderOnly (8, 3, 4))
        atLeast (2, lists) should (not contain inOrderOnly (3, 8, 5) and not contain inOrderOnly (8, 3, 4))
        atMost (2, lists) should (not contain inOrderOnly (2, 4, 3) and contain inOrderOnly (2, 3, 4))
        no (list1s) should (not contain inOrderOnly (1, 2, 3) and not contain inOrderOnly (1, 2, 3))

        val e1 = intercept[TestFailedException] {
          all (lists) should (not contain inOrderOnly (2, 3, 4) and not contain inOrderOnly (8, 3, 4))
        }
        checkMessageStackDepth(e1, allErrMsg(2, decorateToStringValue(List(2, 3, 4)) + " contained only " + "(2, 3, 4)" + " in order", thisLineNumber - 2, lists), fileName, thisLineNumber - 2)

        val e2 = intercept[TestFailedException] {
          all (lists) should (not contain inOrderOnly (3, 6, 8) and not contain inOrderOnly (2, 3, 4))
        }
        checkMessageStackDepth(e2, allErrMsg(2, decorateToStringValue(List(2, 3, 4)) + " did not contain only " + "(3, 6, 8)" + " in order" + ", but " + decorateToStringValue(List(2, 3, 4)) + " contained only " + "(2, 3, 4)" + " in order", thisLineNumber - 2, lists), fileName, thisLineNumber - 2)

        val e3 = intercept[TestFailedException] {
          all (hiLists) should (not contain inOrderOnly ("hi", "hello") and not contain inOrderOnly ("ho", "hey", "howdy"))
        }
        checkMessageStackDepth(e3, allErrMsg(0, decorateToStringValue(List("hi", "hello")) + " contained only " + "(\"hi\", \"hello\")" + " in order", thisLineNumber - 2, hiLists), fileName, thisLineNumber - 2)

        val e4 = intercept[TestFailedException] {
          all (hiLists) should (not contain inOrderOnly ("ho", "hey", "howdy") and not contain inOrderOnly ("hi", "hello"))
        }
        checkMessageStackDepth(e4, allErrMsg(0, decorateToStringValue(List("hi", "hello")) + " did not contain only " + "(\"ho\", \"hey\", \"howdy\")" + " in order" + ", but " + decorateToStringValue(List("hi", "hello")) + " contained only " + "(\"hi\", \"hello\")" + " in order", thisLineNumber - 2, hiLists), fileName, thisLineNumber - 2)
      }

      def `should use the implicit Equality in scope` {
        implicit val ise = upperCaseStringEquality

        all (hiLists) should (not contain inOrderOnly ("HELLO", "HI") and not contain inOrderOnly ("HELLO", "HO"))

        val e1 = intercept[TestFailedException] {
          all (hiLists) should (not contain inOrderOnly ("HI", "HELLO") and not contain inOrderOnly ("HO", "HE"))
        }
        checkMessageStackDepth(e1, allErrMsg(0, decorateToStringValue(List("hi", "hello")) + " contained only " + "(\"HI\", \"HELLO\")" + " in order", thisLineNumber - 2, hiLists), fileName, thisLineNumber - 2)

        val e2 = intercept[TestFailedException] {
          all (hiLists) should (not contain inOrderOnly ("HELLO", "HI") and not contain inOrderOnly ("HI", "HELLO"))
        }
        checkMessageStackDepth(e2, allErrMsg(0, decorateToStringValue(List("hi", "hello")) + " did not contain only " + "(\"HELLO\", \"HI\")" + " in order" + ", but " + decorateToStringValue(List("hi", "hello")) + " contained only " + "(\"HI\", \"HELLO\")" + " in order", thisLineNumber - 2, hiLists), fileName, thisLineNumber - 2)
      }

      def `should use an explicitly provided Equality` {
        (all (hiLists) should (not contain inOrderOnly ("HELLO", "HI") and not contain inOrderOnly ("HELLO", "HO"))) (decided by upperCaseStringEquality, decided by upperCaseStringEquality)
        val e1 = intercept[TestFailedException] {
          (all (hiLists) should (not contain inOrderOnly ("HI", "HELLO") and not contain inOrderOnly ("HO", "HE"))) (decided by upperCaseStringEquality, decided by upperCaseStringEquality)
        }
        checkMessageStackDepth(e1, allErrMsg(0, decorateToStringValue(List("hi", "hello")) + " contained only " + "(\"HI\", \"HELLO\")" + " in order", thisLineNumber - 2, hiLists), fileName, thisLineNumber - 2)

        val e2 = intercept[TestFailedException] {
          (all (hiLists) should (not contain inOrderOnly ("HELLO", "HI") and not contain inOrderOnly ("HI", "HELLO"))) (decided by upperCaseStringEquality, decided by upperCaseStringEquality)
        }
        checkMessageStackDepth(e2, allErrMsg(0, decorateToStringValue(List("hi", "hello")) + " did not contain only " + "(\"HELLO\", \"HI\")" + " in order" + ", but " + decorateToStringValue(List("hi", "hello")) + " contained only " + "(\"HI\", \"HELLO\")" + " in order", thisLineNumber - 2, hiLists), fileName, thisLineNumber - 2)
      }

      def `should throw NotAllowedException with correct stack depth and message when RHS contain duplicated value` {
        val e1 = intercept[exceptions.NotAllowedException] {
          all (list1s) should (not contain inOrderOnly (1, 2, 2, 3) and not contain inOrderOnly (8, 3, 4))
        }
        e1.failedCodeFileName.get should be (fileName)
        e1.failedCodeLineNumber.get should be (thisLineNumber - 3)
        e1.message should be (Some(Resources("inOrderOnlyDuplicate")))

        val e2 = intercept[exceptions.NotAllowedException] {
          all (list1s) should (not contain inOrderOnly (8, 3, 4) and not contain inOrderOnly (1, 2, 2, 3))
        }
        e2.failedCodeFileName.get should be (fileName)
        e2.failedCodeLineNumber.get should be (thisLineNumber - 3)
        e2.message should be (Some(Resources("inOrderOnlyDuplicate")))
      }
    }

    object `when used with (not be xx and not contain inOrderOnly xx)` {

      def `should do nothing if valid, else throw a TFE with an appropriate error message` {
        all (list1s) should (not be_== (List(2)) and not contain inOrderOnly (8, 3, 4))
        atLeast (2, lists) should (not be_== (List(3)) and not contain inOrderOnly (8, 3, 4))
        atMost (2, lists) should (not be_== (List(2, 3, 4)) and not contain inOrderOnly (2, 3, 4))
        no (list1s) should (not be_== (List(1, 2, 2, 3)) and not contain inOrderOnly (1, 2, 3))

        val e1 = intercept[TestFailedException] {
          all (lists) should (not be_== (List(2, 3, 4)) and not contain inOrderOnly (8, 3, 4))
        }
        checkMessageStackDepth(e1, allErrMsg(2, decorateToStringValue(List(2, 3, 4)) + " was equal to " + decorateToStringValue(List(2, 3, 4)), thisLineNumber - 2, lists), fileName, thisLineNumber - 2)

        val e2 = intercept[TestFailedException] {
          all (lists) should (not be_== (List(3)) and not contain inOrderOnly (2, 3, 4))
        }
        checkMessageStackDepth(e2, allErrMsg(2, decorateToStringValue(List(2, 3, 4)) + " was not equal to " + decorateToStringValue(List(3)) + ", but " + decorateToStringValue(List(2, 3, 4)) + " contained only " + "(2, 3, 4)" + " in order", thisLineNumber - 2, lists), fileName, thisLineNumber - 2)

        val e3 = intercept[TestFailedException] {
          all (hiLists) should (not be_== (List("hi", "hello")) and not contain inOrderOnly ("ho", "hey", "howdy"))
        }
        checkMessageStackDepth(e3, allErrMsg(0, decorateToStringValue(List("hi", "hello")) + " was equal to " + decorateToStringValue(List("hi", "hello")), thisLineNumber - 2, hiLists), fileName, thisLineNumber - 2)

        val e4 = intercept[TestFailedException] {
          all (hiLists) should (not be_== (List("ho")) and not contain inOrderOnly ("hi", "hello"))
        }
        checkMessageStackDepth(e4, allErrMsg(0, decorateToStringValue(List("hi", "hello")) + " was not equal to " + decorateToStringValue(List("ho")) + ", but " + decorateToStringValue(List("hi", "hello")) + " contained only " + "(\"hi\", \"hello\")" + " in order", thisLineNumber - 2, hiLists), fileName, thisLineNumber - 2)
      }

      def `should use the implicit Equality in scope` {
        implicit val ise = upperCaseStringEquality

        all (hiLists) should (not be_== (List("ho")) and not contain inOrderOnly ("HO", "HELLO"))

        val e1 = intercept[TestFailedException] {
          all (hiLists) should (not be_== (List("hi", "hello")) and not contain inOrderOnly ("HELLO", "HI"))
        }
        checkMessageStackDepth(e1, allErrMsg(0, decorateToStringValue(List("hi", "hello")) + " was equal to " + decorateToStringValue(List("hi", "hello")), thisLineNumber - 2, hiLists), fileName, thisLineNumber - 2)

        val e2 = intercept[TestFailedException] {
          all (hiLists) should (not be_== (List("ho")) and not contain inOrderOnly ("HI", "HELLO"))
        }
        checkMessageStackDepth(e2, allErrMsg(0, decorateToStringValue(List("hi", "hello")) + " was not equal to " + decorateToStringValue(List("ho")) + ", but " + decorateToStringValue(List("hi", "hello")) + " contained only " + "(\"HI\", \"HELLO\")" + " in order", thisLineNumber - 2, hiLists), fileName, thisLineNumber - 2)
      }

      def `should use an explicitly provided Equality` {
        (all (hiLists) should (not be_== (List("ho")) and not contain inOrderOnly ("HO", "HELLO"))) (decided by upperCaseStringEquality)
        val e1 = intercept[TestFailedException] {
          (all (hiLists) should (not be_== (List("hi", "hello")) and not contain inOrderOnly ("HELLO", "HI"))) (decided by upperCaseStringEquality)
        }
        checkMessageStackDepth(e1, allErrMsg(0, decorateToStringValue(List("hi", "hello")) + " was equal to " + decorateToStringValue(List("hi", "hello")), thisLineNumber - 2, hiLists), fileName, thisLineNumber - 2)

        val e2 = intercept[TestFailedException] {
          (all (hiLists) should (not be_== (List("ho")) and not contain inOrderOnly ("HI", "HELLO"))) (decided by upperCaseStringEquality)
        }
        checkMessageStackDepth(e2, allErrMsg(0, decorateToStringValue(List("hi", "hello")) + " was not equal to " + decorateToStringValue(List("ho")) + ", but " + decorateToStringValue(List("hi", "hello")) + " contained only " + "(\"HI\", \"HELLO\")" + " in order", thisLineNumber - 2, hiLists), fileName, thisLineNumber - 2)
      }

      def `should throw NotAllowedException with correct stack depth and message when RHS contain duplicated value` {
        val e1 = intercept[exceptions.NotAllowedException] {
          all (list1s) should (not be_== (List(2)) and not contain inOrderOnly (1, 2, 2, 3))
        }
        e1.failedCodeFileName.get should be (fileName)
        e1.failedCodeLineNumber.get should be (thisLineNumber - 3)
        e1.message should be (Some(Resources("inOrderOnlyDuplicate")))
      }
    }
  }
}


text:
function isNode() {
  if (typeof window === 'undefined')
    return true;

  return false;
}

export default {
  globalContext : isNode() ? global : window,
  isNode        : isNode
};

redpajama_set_name: RedPajamaGithub


text:
function varargout = remez(f,varargin)
% Best polynomial or rational approximation.
%
% REMEZ(F,M,N) computes the best rational approximation of type [M/N] of a
% chebfun F using the Remez algorithm.  The particular case REMEZ(F,N)
% computes the best polynomial approximation of degree N .
%
% REMEZ(...'tol',TOL) uses the value TOL as the termination tolerance on
% the increase of the levelled error.
%
% REMEZ(...'display','iter') displays output at each iteration.
%
% REMEZ(...'maxiter',MAXITER) uses MAXITER as the maximum number of
% iterations allowed.
%
% REMEZ(...'plotfcns','error') plots the error function while the algorithm
% executes.
%
% P = REMEZ(...) returns a chebfun P for the best polynomial approximation.
%
% [P,Q] = REMEZ(...) returns chebfuns P and Q for best rational
% approximation. [P,Q,R_HANDLE] = REMEZ(...) also returns a function handle
% R_HANDLE to evaluate the rational function P/Q.
%
% [P,ERR] = REMEZ(...) and [P,Q,R_HANDLE,ERR] = REMEZ(...) also return the
% maximum error ERR.
%
% [P,ERR,STATUS] = REMEZ(...) and [P,Q,R_HANDLE,ERR,STATUS] = REMEZ(...)
% also return the structure array STATUS with the fields DELTA, ITER, DIFFX
% and XK with the obtained tolerance, number of performed iterations,
% maximum correction in the last trial reference and last trial reference
% on which the error equioscillates respectively.
%
% This code is quite reliable for polynomial approximations but rather
% fragile for rational approximations.  Better results can often be
% obtained with CF, especially if f is smooth.
%
% See Pachon and Trefethen, "Barycentric-Remez algorithms for best
% polynomial approximation in the chebfun system", BIT Numerical
% Mathematics 49 (2009),721-741) and Pachon, "Algorithms for
% Polynomial and Rational Approximation", D.Phil. Thesis, University of
% Oxford, 2010 (Chapter 6).

% Copyright 2011 by The University of Oxford and The Chebfun Developers.
% See http://www.maths.ox.ac.uk/chebfun/ for Chebfun information.

if numel(f) > 1, error('CHEBFUN:remez:quasi',...
        'Remez does not currently support quasimatrices'); end

if numel(f) > 1, % Deal with quasimatrices
    trans = false;
    if get(f,'trans')
        f = f.'; trans = true;
    end
    r = cell(1,numel(f)); p = chebfun; q = chebfun;
    s = zeros(1,numel(f));
    for k = 1:numel(f)             % loop over chebfuns
      if (nargin < 4), M = length(f(:,k)) - 1; end
      [p(:,k) q(:,k) r{k} s(k)] = remez(f(:,k),varargin);
    end
    if trans
        r = r.'; p = p.'; q = q.';
    end
    return
end
if any(get(f,'exps')<0),
    error('CHEBFUN:remez:inf',...
     'Remez does not currently support functions which diverge to infinity');
end
spl_ini = chebfunpref('splitting');
splitting off,
if ~mod(nargin,2) % even number of input parameters: polynomial case
    N = varargin{1};
    m = N;
    n = 0; rational = 0;
    varargin = varargin(2:end);
else % odd number of input parameters: rational case
       m = varargin{1}; n = varargin{2};
       rational = 1;
       [m,n] = detectdegeneracy(f,m,n);
       N = m+n;
       varargin = varargin(3:end);
end
% parameters
iter = 0;
maxit = 20;
[a,b] = domain(f);
sigma = ones(N+2,1); sigma(2:2:end) = -1;  % alternating signs
normf = norm(f);
delta = normf; deltamin = inf;
diffx = 1;
disp_iter = 0;
draw_option = 0;
tol = 1e-16*(N^2+10);   % tolerance
% read optional input arguments
for k = 1:2:length(varargin)
    if strcmpi('tol',varargin{k})
        tol = varargin{k+1};
    elseif strcmpi('display',varargin{k})
        disp_iter = 1;
    elseif strcmpi('maxiter',varargin{k})
        maxit = varargin{k+1};
    elseif strcmpi('plotfcns',varargin{k})
        draw_option = 1;
    else
        error('CHEBFUN:remez:input_parameters',...
            'Unrecognized sequence of input parameters.')
    end
end

if n == 0, qk = 1; q = chebfun(1,[a,b]); qmin = q; end
% initial reference
flag = 0;
if n > 0 % initial reference from Chebyshev-Pade
    if f.nfuns == 1
        % [p,q] = chebpade(f,m,n);     % <- change initial guess to Chebyshev-Pade
         [p,q] = cf(f,m,n);             % <- change initial guess to CF
    else
        % [p,q] = chebpade(f,m,n,5*N); % <- change initial guess to Chebyshev-Pade
         [p,q] = cf(f,m,n,5*N);        % <- change initial guess to CF
    end
    [xk,err,e,flag] = exchange([],0,2,f,p,q,N+2);
end
if n==0 || flag == 0
    xk = chebpts(N+2,[a,b]);
end
xo = xk;

if disp_iter
    disp(['It.     Max(|Error|)       |ErrorRef|      Delta ErrorRef      Delta Ref'])
end

if draw_option
    xxk = linspace(a,b,300);
end

while (delta/normf > tol) && iter <maxit && diffx > 0
    %iter
    fk = feval(f,xk);                             % function values
    w = bary_weights(xk);                         % compute barycentric weights
    % computatiom of levelled error
    if n > 0
        % in case of rational case, obtain simultaneously the levelled
        % error and the values of the trial denominator
       [C,ignored] = qr(fliplr(vander(xk)));            % orthogonal matrix wrt <,>_xk
       ZL=C(:,m+2:N+2).'*diag(fk)*C(:,1:n+1);     % left rational interp matrix
       ZR=C(:,m+2:N+2).'*diag(sigma)*C(:,1:n+1);  % right rational interp matrix
       [v,d] = eig(ZL,ZR);                        % solve generalize eig problem
       qk_all = C(:,1:n+1)*v;                     % compute all possible qk
       pos =  find(abs(sum(sign(qk_all)))==N+2);  % signs' changes of each qk
       if isempty(pos)||length(pos)>1
         error('Trial interpolant too far from optimal');
       end
       qk = qk_all(:,pos);                        % keep qk with unchanged sign
       h = d(pos,pos);                            % levelled reference error
    else
       % in case of polynomial case, compute directly the levelled error
       h = (w'*fk)/(w'*sigma);                    % levelled reference error
    end
    if h==0, h = 1e-19; end                       % perturb error if necessary
    pk = (fk - h*sigma).*qk;                      % vals of r x q in reference
    p = chebfun(@(x) bary(x,pk,xk,w),[a,b],m+1);  % chebfun of trial numerator
    if n > 0
     q =chebfun(@(x) bary(x,qk,xk,w),[a,b],n+1);  % chebfun of trial denominator
    end
    if draw_option,
        plot(xk,0*xk,'or','markersize',12),  hold on,
    end

    [xk,err,e] = exchange(xk,h,2,f,p,q,N+2);
    if err/normf > 1e5                            % if overshoot, recompute with one-
        [xk,err,e] = exchange(xo,h,1,f,p,q,N+2);  % point exchange
    end
        if draw_option
          plot(xk,0*xk,'*k','markersize',12);
          plot(xxk,e(xxk)),
          hold off,
          xlim([a,b])
          legend('current ref','next ref','error')
          drawnow,
         end
    diffx = max(abs([xo-xk]));
    xo = xk;
    delta = err - abs(h);                         % stopping value
    if delta < deltamin,                          % store poly with minimal norm
      pmin = p; errmin = err; xkmin = xk;
      if n > 0 , qmin = q; end
      deltamin = delta;
      itermin = iter;
    end

    iter = iter+1;
    if disp_iter
      disp([num2str(iter),'        ',num2str(err,'%5.4e'),'        ',...
          num2str(abs(h),'%5.4e'),'        ',...
          num2str(delta/normf,'%5.4e'),'        ',num2str(diffx,'%5.4e')]),
    end
end
itermin;
p = pmin;
err = errmin;
xk = xkmin;
delta = deltamin;
if delta/normf > tol
    warning('CHEBFUN:remez:convergence',...
        ['Remez algorithm did not converge after ',num2str(iter),...
        ' iterations to the tolerance ',num2str(tol),'.']),
end

%if rational , q = qmin; end
if rational , q = simplify(qmin,1e-14,'force'); end
p = simplify(p,1e-14,'force');
if ~rational
    if nargout >= 1, varargout(1) = {p};   end
    if nargout >= 2, varargout(2) = {err}; end
    if nargout == 3,
        status.delta = delta/normf;
        status.iter = iter;
        status.diffx = diffx;
        status.xk =  xk;
        varargout(4) = {status}; end
elseif rational
    if nargout >= 1, varargout(1) = {p};   end
    if nargout >= 2, varargout(2) = {q}; end
    if nargout >= 3, varargout(3) = {@(x) feval(p,x)./feval(q,x)};  end
    if nargout >= 4, varargout(4) = {err};  end
    if nargout == 5,
        status.delta = delta/normf;
        status.iter = iter;
        status.diffx = diffx;
        status.xk = xk;
        varargout(5) = {status}; end
end
chebfunpref('splitting',spl_ini),

%-------------------------------------------------------------------------%
    function [xk,norme,e,flag] = exchange(xk, h, method, f, p, q, Npts)
    % EXCHANGE modifies an equioscillation reference using the Remez
    % algorithm.
    %
    % EXCHANGE(XK,H,METHOD,F,P,Q) performs one step of the Remez algorithm
    % for the best rational approximation of the chebfun F of the target
    % function according to the first method (METHOD = 1), i.e. exchanges
    % only one point, or the second method (METHOD = 2), i.e. exchanges all
    % the reference points. XK is a column vector with the reference, H is
    % the levelled error, P is the numerator and Q is the denominator of
    % the trial rational function P/Q.
    %
    % [XK, NORME, E_HANDLE, FLAG] = EXCHANGE(...) returns the modified
    % reference XK, the supremum norm of the error NORME (included as an
    % output argument, since it is readily computing in EXCHANGE and is
    % used later in REMEZ), a function handle E_HANDLE for the error, and a
    % FLAG indicating whether there were at least N+2 alternating extrema
    % of the error to form the next reference (FLAG = 1) or not (FLAG = 0).
    %
    % [XK,...] = EXCHANGE([],0,METHOD,F,P,Q,N+2) returns a grid of
    % N+2 points XK where the error F - P/Q alternates in sign (but not
    % necessarily equioscillates). This feature of EXCHANGE is useful to
    % start REMEZ from an initial trial function rather than an initial
    % trial reference.
    [a,b] = domain(f);
    e_num = (q.^2).*diff(f) - q.*diff(p) + p.*diff(q);
    rr = [a; roots(e_num); b];                   % extrema of the error
    e = @(x) feval(f,x) - feval(p,x)./feval(q,x);                  % fnc handle of error
    if method == 1                               % one-point exchange
        [tmp,pos] = max(abs(feval(e,rr))); pos = pos(1);
    else                                         % full exchange
        pos = find(abs(e(rr))>=abs(h));    % vals above leveled error
    end
    [r,m] = sort([rr(pos); xk]);
    v = ones(Npts,1); v(2:2:end) = -1;
    er = [feval(e,rr(pos));v*h];
    er = er(m);
    repeated = diff(r)==0;
    r(repeated) = []; er(repeated) = [];         % delete repeated pts
    s = r(1); es = er(1);                        % pts and vals to be kept
    for i = 2:length(r)
      if sign(er(i)) == sign(es(end)) &&...      % from adjacent pts w/ same sign
              abs(er(i))>abs(es(end))            % keep the one w/ largest val
          s(end) = r(i); es(end) = er(i);
      elseif sign(er(i)) ~= sign(es(end))        % if sign of error changes and
          s = [s; r(i)]; es = [es; er(i)];       % pts and vals
      end
    end
    [norme,idx] = max(abs(es));                  % choose n+2 consecutive pts
    d = max(idx-Npts+1,1);                       % that include max of error
    if Npts<= length(s)
        xk = s(d:d+Npts-1); flag = 1;
    else
        xk = s; flag = 0;
    end

    % END EXCHANGE

%-------------------------------------------------------------------------%
    function [m,n] = detectdegeneracy(f,m,n)
    % DETECTDEGENERACY modifies the type of the rational approximant if
    % the function is even or odd and the defect is larger than zero.
    %
    % [M,N] = DETECTDEGENERACY(F,M,N) modifies m and n to correct the
    % defect of the rational approximation if the target function is
    % even or odd. In either case, the Walsh table is covered with
    % blocks of size 2x2, e.g. for even function the best rational
    % approximant is the same for types [m/n], [m+1/n], [m/n+1] and
    % [m+1/n+1], with m and n even. This strategy is similar to the
    % one proposed by van Deun and Trefethen for CF approximation in
    % Chebfun (see chebfun/cf.m).
    %return
    [a,b] = domain(f);
    if f.nfuns>1 || length(f)>128,
      f = chebfun(f,[a,b],128);
    end
    c = chebpoly(f); c(end) = 2*c(end);
    if max(abs(c(end-1:-2:1)))/f.scl < eps, % f is an even function
        if mod(m,2) ,m = m - 1; end
        if mod(n,2), n = n -1; end
    elseif max(abs(c(end:-2:1)))/f.scl < eps, % f is an odd function
        if ~mod(m,2), m = m-1; end
        if mod(n,2), n = n - 1; end
    end

    % END DETECTDEGENERACY
%-------------------------------------------------------------------------%


text:
package com.salt.payment.client.creditcard.api;

import java.util.Hashtable;

/**
 * Returned after any call to the Gateway.  The applicable methods will depend on the type of call made
 *
 */
public class TransactionResponse {

    //the unformatted response data provided by the Gateway
    private String data;

    private String cardType = "";
    private double txnAmount = 0.0;
    private long txnId = 0;
    private String txnType = "";
    private String txnDate = "";
    private int respCode = -1;
    private String isoCode = "";
    private String authCode = "";
    private String message = "";
    private boolean isComplete = false;
    private boolean isTimeout = false;

    public TransactionResponse(String data) {
        this.data = data;
        this.format();
    }

    private void format() {
        Hashtable<String, String> ht = new Hashtable<String, String>();
        String param[] = this.data.trim().split(";");
        for (int i = 0; i < param.length; i++) {
            String key[] = param[i].split("=");
            if (key.length == 2) {
                ht.put(key[0], key[1]);
            }
        }
        // get response

        if (ht.containsKey("cardType")) {
            this.cardType = (String) ht.get("cardType");
        }
        if (ht.containsKey("txnId")) {
            try {
                this.txnId = Long.parseLong((String) ht.get("txnId"));
            } catch (NumberFormatException ex) {
                // If this happens txnId is a string --> will default to 0
            }
        }
        if (ht.containsKey("txnAmount")) {
            try {
                this.txnAmount = Double.parseDouble((String) ht.get("txnAmount"));
            } catch (NumberFormatException ex) {
                // If this happens, txnAmount is a string --> will default to
                // 0.0
            }
        }
        if (ht.containsKey("txnType")) {
            this.txnType = (String) ht.get("txnType");
        }
        if (ht.containsKey("txnDate")) {
            this.txnDate = (String) ht.get("txnDate");
        }
        if (ht.containsKey("respCode")) {
            try {
                this.respCode = Integer.parseInt((String) ht.get("respCode"));
            } catch (NumberFormatException ex) {
                // If this happens, respCode is a string --> will default to -1
            }
        }
        if (ht.containsKey("isoCode")) {
            this.isoCode = (String) ht.get("isoCode");
        }
        if (ht.containsKey("authCode")) {
            this.authCode = (String) ht.get("authCode");
        }
        if (ht.containsKey("message")) {
            this.message = (String) ht.get("message");
        }
        if (ht.containsKey("isComplete")) {
            this.isComplete = Boolean.parseBoolean((String) ht.get("isComplete"));
        }
        if (ht.containsKey("isTimeout")) {
            this.isTimeout = Boolean.parseBoolean((String) ht.get("isTimeout"));
        }
    }

    public String getRespData() {
        return this.data;
    }

    public String getCardType() {
        return this.cardType;
    }

    public double getTxnAmount() {
        return this.txnAmount;
    }

    public long getTxnId() {
        return this.txnId;
    }

    public String getTxnType() {
        return this.txnType;
    }

    public String getTxnDate() {
        return this.txnDate;
    }

    public int getRespCode() {
        return this.respCode;
    }

    public String getIsoCode() {
        return this.isoCode;
    }

    public String getAuthCode() {
        return this.authCode;
    }

    public String getMessage() {
        return this.message;
    }

    public boolean isTimeout() {
        return this.isTimeout;
    }

    public boolean isComplete() {
        return this.isComplete;
    }
}// end class


text:
package arez.doc.examples.at_memoize;

import arez.annotations.ArezComponent;
import arez.annotations.Memoize;
import arez.annotations.Observable;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

@ArezComponent
public abstract class CurrencyCollection
{
  @Observable
  public String getFilter()
  {
    // Return value used to filter currencies by their symbol
    //DOC ELIDE START
    return _filter;
    //DOC ELIDE END
  }

  @Observable
  public List<Currency> getCurrencies()
  {
    // Return the list of all currencies here
    //DOC ELIDE START
    return _currencies;
    //DOC ELIDE END
  }

  // Memoized method that only changes when a currency is added or removed
  @Memoize
  public int getCurrencyCount()
  {
    return getCurrencies().size();
  }

  // Memoized method that changes when a currency is added or removed,
  // or the filter changes
  @Memoize
  public List<Currency> filteredCurrencies()
  {
    return getCurrencies()
      .stream()
      .filter( c -> c.getSymbol().contains( getFilter() ) )
      .collect( Collectors.toList() );
  }

  //DOC ELIDE START
  private List<Currency> _currencies = new ArrayList<>();
  private String _filter;

  public void setFilter( final String filter )
  {
    _filter = filter;
  }

  public void setCurrencies( final List<Currency> currencies )
  {
    _currencies = currencies;
  }

  //DOC ELIDE END
}


text:
namespace P01.CountWorkingDays
{
    using System;
    using System.Collections.Generic;
    using System.Globalization;
    using System.Linq;

    public class StartUp
    {
        public static void Main(string[] args)
        {
            string startData = Console.ReadLine();
            string endData = Console.ReadLine();

            DateTime startTime = DateTime.ParseExact(startData, "dd-MM-yyyy", CultureInfo.InvariantCulture);
            DateTime endTime = DateTime.ParseExact(endData, "dd-MM-yyyy", CultureInfo.InvariantCulture);
            int counter = 0;

            DateTime[] officialHolidays = new DateTime[]
            {
                 new DateTime(4, 01, 01),
                 new DateTime(4, 03, 03),
                 new DateTime(4, 05, 01),
                 new DateTime(4, 05, 06),
                 new DateTime(4, 05, 24),
                 new DateTime(4, 09, 06),
                 new DateTime(4, 09, 22),
                 new DateTime(4, 11, 01),
                 new DateTime(4, 12, 24),
                 new DateTime(4, 12, 25),
                 new DateTime(4, 12, 26),
            };

            for (DateTime date = startTime; date <= endTime; date = date.AddDays(1.0))
            {
                DateTime current = new DateTime(4, date.Month, date.Day);
                if ((date.DayOfWeek != DayOfWeek.Saturday) && (date.DayOfWeek != DayOfWeek.Sunday) && !(officialHolidays.Contains(current)))
                {
                    counter++;
                }

            }
            Console.WriteLine(counter);
        }
    }
}


text:
from docker import client as docker_py_client
import mock

from magnum.conductor.handlers.common import docker_client
from magnum.tests import base

class DockerClientTestCase(base.BaseTestCase):
    def test_docker_client_init(self):
        client = docker_client.DockerHTTPClient()

        self.assertEqual(docker_client.DEFAULT_DOCKER_REMOTE_API_VERSION,
                         client.api_version)
        self.assertEqual(docker_client.DEFAULT_DOCKER_TIMEOUT,
                         client.timeout)

    def test_docker_client_init_timeout(self):
        expected_timeout = 300
        client = docker_client.DockerHTTPClient(timeout=expected_timeout)

        self.assertEqual(docker_client.DEFAULT_DOCKER_REMOTE_API_VERSION,
                         client.api_version)
        self.assertEqual(expected_timeout, client.timeout)

    def test_docker_client_init_url(self):
        expected_url = 'http://127.0.0.1:2375'
        client = docker_client.DockerHTTPClient(url=expected_url)

        self.assertEqual(expected_url,
                         client.base_url)
        self.assertEqual(docker_client.DEFAULT_DOCKER_REMOTE_API_VERSION,
                         client.api_version)
        self.assertEqual(docker_client.DEFAULT_DOCKER_TIMEOUT,
                         client.timeout)

    def test_docker_client_init_version(self):
        expected_version = '1.16'
        client = docker_client.DockerHTTPClient(ver=expected_version)

        self.assertEqual(expected_version,
                         client.api_version)
        self.assertEqual(docker_client.DEFAULT_DOCKER_TIMEOUT,
                         client.timeout)

    @mock.patch.object(docker_py_client.Client, 'inspect_container')
    @mock.patch.object(docker_py_client.Client, 'containers')
    def test_list_instances(self, mock_containers, mock_inspect):
        client = docker_client.DockerHTTPClient()

        containers = [dict(Id=x) for x in range(0, 3)]
        inspect_results = [dict(Config=dict(Hostname=x)) for x in range(0, 3)]

        mock_containers.return_value = containers
        mock_inspect.side_effect = inspect_results

        instances = client.list_instances()

        self.assertEqual([0, 1, 2], instances)
        mock_containers.assert_called_once_with(all=True)
        mock_inspect.assert_has_calls([mock.call(x) for x in range(0, 3)])

    @mock.patch.object(docker_py_client.Client, 'inspect_container')
    @mock.patch.object(docker_py_client.Client, 'containers')
    def test_list_instances_inspect(self, mock_containers, mock_inspect):
        client = docker_client.DockerHTTPClient()

        containers = [dict(Id=x) for x in range(0, 3)]
        inspect_results = [dict(Config=dict(Hostname=x)) for x in range(0, 3)]

        mock_containers.return_value = containers
        mock_inspect.side_effect = inspect_results

        instances = client.list_instances(inspect=True)

        self.assertEqual(inspect_results, instances)
        mock_containers.assert_called_once_with(all=True)
        mock_inspect.assert_has_calls([mock.call(x) for x in range(0, 3)])

    @mock.patch.object(docker_py_client.Client, '_raise_for_status')
    @mock.patch.object(docker_py_client.Client, '_post')
    @mock.patch.object(docker_py_client.Client, '_url')
    def test_pause(self, mock_url, mock_post, mock_raise_for_status):
        client = docker_client.DockerHTTPClient()

        client.pause('someid')

        mock_url.assert_called_once_with('/containers/someid/pause')
        mock_post.assert_called_once_with(mock_url.return_value)
        mock_raise_for_status.assert_called_once_with(
            mock_post.return_value)

    @mock.patch.object(docker_py_client.Client, '_raise_for_status')
    @mock.patch.object(docker_py_client.Client, '_post')
    @mock.patch.object(docker_py_client.Client, '_url')
    def test_pause_container_dict(self, mock_url, mock_post,
                                  mock_raise_for_status):
        client = docker_client.DockerHTTPClient()

        client.pause(dict(Id='someid'))

        mock_url.assert_called_once_with('/containers/someid/pause')
        mock_post.assert_called_once_with(mock_url.return_value)
        mock_raise_for_status.assert_called_once_with(
            mock_post.return_value)

    @mock.patch.object(docker_py_client.Client, '_raise_for_status')
    @mock.patch.object(docker_py_client.Client, '_post')
    @mock.patch.object(docker_py_client.Client, '_url')
    def test_unpause(self, mock_url, mock_post, mock_raise_for_status):
        client = docker_client.DockerHTTPClient()

        client.unpause('someid')

        mock_url.assert_called_once_with('/containers/someid/unpause')
        mock_post.assert_called_once_with(mock_url.return_value)
        mock_raise_for_status.assert_called_once_with(
            mock_post.return_value)

    @mock.patch.object(docker_py_client.Client, '_raise_for_status')
    @mock.patch.object(docker_py_client.Client, '_post')
    @mock.patch.object(docker_py_client.Client, '_url')
    def test_unpause_container_dict(self, mock_url, mock_post,
                                    mock_raise_for_status):
        client = docker_client.DockerHTTPClient()

        client.unpause(dict(Id='someid'))

        mock_url.assert_called_once_with('/containers/someid/unpause')
        mock_post.assert_called_once_with(mock_url.return_value)
        mock_raise_for_status.assert_called_once_with(
            mock_post.return_value)

    @mock.patch.object(docker_py_client.Client, 'logs')
    def test_get_container_logs(self, mock_logs):
        client = docker_client.DockerHTTPClient()

        client.get_container_logs('someid')

        mock_logs.assert_called_once_with('someid')


text:
<!DOCTYPE html>

        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <title>russ rinzler</title>
        <link rel="shortcut icon" href="favicon.ico">

                Russ Rinzler's Portfolio

                it's loading. unfortunately, javascript must be enabled.


text:
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.

using Microsoft.Common.Core.UI.Commands;
using Microsoft.VisualStudio.R.Packages.R;

namespace Microsoft.VisualStudio.R.Package.Commands {
    internal static class CommandAsyncToOleMenuCommandShimFactory {
        public static CommandAsyncToOleMenuCommandShim CreateRCmdSetCommand(int id, IAsyncCommand command) => new CommandAsyncToOleMenuCommandShim(RGuidList.RCmdSetGuid, id, command);
        public static AsyncCommandRangeToOleMenuCommandShim CreateRCmdSetCommand(int id, IAsyncCommandRange command) => new AsyncCommandRangeToOleMenuCommandShim(RGuidList.RCmdSetGuid, id, command);
    }
}


text:
import os
from subprocess import check_call

build = os.environ['BUILD']
config = os.environ['CONFIGURATION']
platform = os.environ['PLATFORM']
path = os.environ['PATH']
image = os.environ['APPVEYOR_BUILD_WORKER_IMAGE']
jobid = os.environ['APPVEYOR_JOB_ID']
cmake_command = ['cmake', '-DFMT_PEDANTIC=ON', '-DCMAKE_BUILD_TYPE=' + config, '..']
if build == 'mingw':
    cmake_command.append('-GMinGW Makefiles')
    build_command = ['mingw32-make', '-j4']
    test_command = ['mingw32-make', 'test']
    # Remove the path to Git bin directory from $PATH because it breaks
    # MinGW config.
    path = path.replace(r'C:\Program Files (x86)\Git\bin', '')
    os.environ['PATH'] = r'C:\MinGW\bin;' + path
else:
    # Add MSBuild 14.0 to PATH as described in
    # http://help.appveyor.com/discussions/problems/2229-v140-not-found-on-vs2105rc.
    os.environ['PATH'] = r'C:\Program Files (x86)\MSBuild\15.0\Bin;' + path
    if image == 'Visual Studio 2019':
        generator = 'Visual Studio 16 2019'
        if platform == 'x64':
            cmake_command.extend(['-A', 'x64'])
    else:
        if image == 'Visual Studio 2015':
            generator = 'Visual Studio 14 2015'
        elif image == 'Visual Studio 2017':
            generator = 'Visual Studio 15 2017'
        if platform == 'x64':
            generator += ' Win64'
    cmake_command.append('-G' + generator)
    build_command = ['cmake', '--build', '.', '--config', config, '--', '/m:4']
    test_command = ['ctest', '-C', config]

check_call(cmake_command)
check_call(build_command)
check_call(test_command)


text:
var devel = require("../src/base/devel");
var util = require("../src/base/util");
var Node = require("../src/core/Node");
var JavaScriptAST = require("../src/core/JavaScriptAST");

var expect = require("chai").expect;
var NodeUtil = require("./testutil").NodeUtil;

var js = JavaScriptAST;

var node = NodeUtil.makePseudoNode;

function sym(model) {
  return node({ ident: model });
}

var evaluating = function (jsast) {
  var evali = eval;
  var caption = jsast.codeOneliner()
                     .replace(/([\s\S]{0,48})([\s\S]*)/,
                              function(s, a, b) { return a + (b ? "..." : ""); });
  return {
    asJSON: {
      willBe: function (value) {
        it("generates " + caption, function () {
          expect(JSON.stringify(evali(jsast.codeOneliner()))).equal(value);
        });
      },
    },
    willBe: function (value) {
      it("generates " + caption, function () {
        expect(evali(jsast.codeOneliner())).equal(value);
      });
    },
  };
};

describe("JavaScriptAST", function () {

  evaluating( js.Literal(node(3)) ).willBe( 3 );

  evaluating(
    js.Add(
      js.Mul(
        js.Literal(node(3)),
        js.Literal(node(100))),
      js.Add(
        js.Literal(node(4)),
        js.Literal(node(10))))
  ).willBe(
    314
  );

  evaluating(
    js.Add_Multi(
      js.Literal(node(3)),
      js.Literal(node("foo")),
      js.Literal(node(100)))
  ).willBe(
    "3foo100"
  );

  evaluating(
    js.Typeof(
      js.Not(
        js.Literal(sym("true"))))
  ).willBe(
    "boolean"
  );

  evaluating(
    js.Call(
      js.Dot( js.Identifier(sym("Math")),
              js.IdentifierName(sym("abs")) ),
      js.Arguments(
        js.Literal( node(-45) )))
  ).willBe(
    45
  );

  evaluating(
    js.Dot( js.Identifier(sym("JSON")),
            js.IdentifierName(sym("stringify")) )
  ).willBe(
    JSON.stringify
  );

  evaluating(
    js.ExpressionStatement(
      js.Comma_Multi(
        js.Literal(node("foo")),
        js.Literal(node("zoo"))))
  ).willBe(
    "zoo"
  );

  evaluating(
    js.Block(
      js.VariableStatement_NoAssign(
        js.Identifier(sym("a"))))
  ).willBe(
    undefined
  );

  evaluating(
    js.Block(
      js.VariableStatement(
        js.VariableDeclarationList(
          js.VariableDeclaration(
            js.Identifier(sym("b")),
            js.Literal(node(100))))),
      js.ExpressionStatement(
        js.Identifier(sym("b"))))
  ).willBe(
    100
  );

  evaluating(
    js.Block(
      js.VariableStatement_NoAssign(
        js.Identifier(sym("a")),
        js.Identifier(sym("b"))),
      js.ExpressionStatement(
        js.Comma_Multi(
          js.Assign(
            js.Identifier(sym("a")),
            js.Literal(node("foo"))),
          js.Assign(
            js.Identifier(sym("b")),
            js.Literal(node("zoo"))))),
      js.Add_Multi(
        js.Identifier(sym("a")),
        js.Identifier(sym("b")),
        js.Identifier(sym("a"))))
  ).willBe(
    "foozoofoo"
  );

  evaluating(
    js.Call(
      js.FunctionExpression(
        undefined,
        js.FormalParameterList(
          js.Identifier(sym("p1")),
          js.Identifier(sym("p2")),
          js.Identifier(sym("p3"))),
        js.SourceElements(
          js.DoStatement(
            js.AddAssign(
              js.Identifier(sym("p1")),
              js.Identifier(sym("p2"))),
            js.Ge(
              js.PreDec(
                js.Identifier(sym("p3"))),
              js.Literal(node(0)))),
          js.ReturnStatement(
            js.Identifier(sym("p1"))))),
      js.Arguments(
        js.Literal(node(100)),
        js.Literal(node(3)),
        js.Literal(node(10))))
  ).willBe(
    133
  );

  function functionize (name, block) {
    return js.Call(
      js.FunctionExpression(
        name ? js.Identifier(sym(name)) : undefined,
        js.FormalParameterList(),
        block),
      js.Arguments());
  }

  evaluating(
    functionize("f", js.SourceElements(
      js.VariableStatement_Direct(
        js.VariableDeclaration(
          js.Identifier(sym("foo")),
          js.Literal(node(42)))),
      js.SwitchStatement(
        js.Identifier(sym("foo")),
        js.CaseClause(
          js.Literal(node(41)),
          js.ReturnStatement(
            js.Add(
              js.Literal(node("match 1st ")),
              js.Identifier(sym("foo"))))),
        js.DefaultClause(
          js.ReturnStatement(
            js.Add(
              js.Literal(node("match default ")),
              js.Identifier(sym("foo"))))),
        js.CaseClause(
          js.Literal(node(43)),
          js.ReturnStatement(
            js.Add(
              js.Literal(node("match 2st ")),
              js.Identifier(sym("foo"))))))))
  ).willBe(
    "match default 42"
  );

  // Literal shortcut
  evaluating(
    js.Add(
      "LiteralShortCutTest",
      42
    )
  ).willBe(
    "LiteralShortCutTest42"
  );

  // Identifier shortcut
 evaluating(
    functionize("IdentifierShortCutTest", js.SourceElements(
      js.VariableStatement_Direct(
        js.VariableDeclaration(
          sym("foo"),
          42)),
      js.ReturnStatement(
        js.Mul(
          sym("foo"),
          3))))
  ).willBe(
    42 * 3
  );

  // XXX_Multi() with one argument.
  evaluating(
    js.Div_Multi( 144 )
  ).willBe(
    144
  );

  // Regression: And_Multi has a higher precedence than Or_Multi.
  // If evaluating (0 && (0 || 1)) generates (0 && 0 || 1) which is
  // identical to ((0 && 0) || 1), the result will be 1.
  evaluating(
    js.And_Multi(
      0,
      js.Or_Multi(
        0,
        1))
  ).willBe(
    0
  );

});


text:
package com.samir.popularmovies.service.integration;

import android.support.annotation.NonNull;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.samir.popularmovies.model.Movie;
import com.samir.popularmovies.model.Page;

import java.io.IOException;
import java.lang.reflect.Modifier;
import java.util.Arrays;
import java.util.List;

/**
 * Created by samir on 7/10/16.
 */

public abstract class HttpCommand implements Command {

    public static final Gson GSON = new GsonBuilder()
            .excludeFieldsWithModifiers(Modifier.FINAL, Modifier.TRANSIENT, Modifier.STATIC)
            .serializeNulls()
            .create();

    protected String getHttpString() throws IOException {
        final HttpClient httpClient = new HttpClient();
        final MoviedbHttpRequest moviedbHttpRequest = new MoviedbHttpRequest(this);
        return httpClient.execute(moviedbHttpRequest);
    }
}


text:
typedef std::map<int,CMqProducer *> MapTopicAndProducer;
MapTopicAndProducer g_oMapProducers;//producer¹ÜÀíÈÝÆ÷

int Init(int iTopicId,const char *pszProducerName,int iChannelKey)
{
    std::string sProducerName(pszProducerName);
    MapTopicAndProducer::iterator it=g_oMapProducers.find(iTopicId);

    if(it==g_oMapProducers.end())
    {
        CMqProducer *pProducer=new CMqProducer();
        int iRet=pProducer->Init(iTopicId,sProducerName,iChannelKey);
        g_oMapProducers.insert(MapTopicAndProducer::value_type(iTopicId,pProducer));
        //if(iRet!=0)
            //std::cout<<pProducer->GetLastErrMsg()<<std::endl;
        return iRet;
    }
    else
        return it->second->Init(iTopicId,sProducerName,iChannelKey);
}

void MultiSendMsg(int iTopicId,char szMsgData[],int iMsglen,stProducerResult *pstRet)
{
    MapTopicAndProducer::iterator it=g_oMapProducers.find(iTopicId);
    if(it==g_oMapProducers.end())
    {
        //std::cout<<"no such producer, topicid: "<<iTopicId<<std::endl;
        pstRet->iRet=-3;//msgqµÄMultiSendMsg·µ»ØÒ쳣Ϊ-1£¬-2
        return;
    }

    std::string sMsgData;
    sMsgData.assign(szMsgData,iMsglen);

    uint32_t dwSeq=0;
    pstRet->iRet=(it->second)->MultiSendMsg(sMsgData,dwSeq);
    pstRet->iSeq=dwSeq;
    //if(pstRet->iRet!=0)
        //std::cout<<(it->second)->GetLastErrMsg()<<std::endl;

}

const char * GetErrMsg(int iTopicId)
{
    MapTopicAndProducer::iterator it=g_oMapProducers.find(iTopicId);
    if(it==g_oMapProducers.end())
        return "Should Not GetErrMsg, because no such producer.";
    else
        return (it->second)->GetLastErrMsg();
}


text:
import os
BASE_DIR = os.path.dirname(os.path.dirname(__file__))

SECRET_KEY = 'r269$heh9at2cot+5l$*$4&xzwsfbbg0&&^prr+e&oh)_4-+ga'
DEBUG = True
TEMPLATE_DEBUG = True
ALLOWED_HOSTS = []
ROOT_URLCONF = 'project.urls'
WSGI_APPLICATION = 'project.wsgi.application'
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True
STATIC_URL = '/static/'

INSTALLED_APPS = (
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'calaccess',
    'lobbying',
)

MIDDLEWARE_CLASSES = (
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
)

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': 'lobbying',
        'USER': 'root',
        'PASSWORD': 'mysql',
        'HOST': 'localhost',
        'PORT': '3306',
        'OPTIONS': {
            'local_infile': 1,
        }
    }
}

try:
    from settings_local import *
except ImportError:
    pass


text:
set -xv

export cluster=RXJ2129
export ending=OCFSRI
export filter=W-C-RC
export lensing_coadd_type="good"
#vim ./adam_do_photometry.sh
export cluster=RXJ2129 ; export detect_filter=${filter};export lensing_filter=${filter} ;export ending=OCFSRI ; export config="10_3"
./adam_do_photometry.sh ${cluster} ${detect_filter} ${lensing_filter} aper PHOTO  2>&1 | tee -a OUT-adam_do_photometry_${cluster}_PHOTO.log
./adam_do_photometry.sh ${cluster} ${detect_filter} ${lensing_filter} aper MERGE STARS BIGMACSCALIB BIGMACSAPPLY 2>&1 | tee -a OUT-adam_do_photometry_${cluster}_allmodes.log

#for fl in `\ls /u/ki/awright/data//MACS1115+01/W-C-RC/SCIENCE/coadd_MACS1115+01_*/coadd.fits` ; do ./adam_quicktools_fix_header_verify.py ${fl} ; ./SeeingClearly_for_coadds.py ${fl} ; done


text:
set( MRPT_HAS_SVS OFF CACHE BOOL "Add support for STOC Stereo Camera?")

if(MRPT_HAS_SVS)
	set( SVS_ROOT_DIR "" CACHE PATH "Path to SVS library root directory")

	if(UNIX)
		# Set to 1, next check for missing things and set to 0 on any error & report message:
		set(CMAKE_MRPT_HAS_SVS 1)

		if(NOT EXISTS ${SVS_ROOT_DIR})
			set(CMAKE_MRPT_HAS_SVS 0)
			message("The directory 'SVS_ROOT_DIR' does not exists. Turn off SVS support or provide the correct path.")
		endif(NOT EXISTS ${SVS_ROOT_DIR})

		if(NOT EXISTS ${SVS_ROOT_DIR}/src/svsclass.h)
			set(CMAKE_MRPT_HAS_SVS 0)
			message("The directory 'SVS_ROOT_DIR' does not contain src/svsclass.h. Turn off SVS support or provide the correct path.")
		endif(NOT EXISTS ${SVS_ROOT_DIR}/src/svsclass.h)

		if(NOT EXISTS ${SVS_ROOT_DIR}/src/dcs.h)
			set(CMAKE_MRPT_HAS_SVS 0)
			message("The directory 'SVS_ROOT_DIR' does not contain src/dcs.h. Turn off SVS support or provide the correct path.")
		endif(NOT EXISTS ${SVS_ROOT_DIR}/src/dcs.h)
	else(UNIX)

		message("Sorry! STOC camera is supported only for LINUX yet. Set MRPT_HAS_SVS to OFF")
		set(CMAKE_MRPT_HAS_SVS 0)
	endif(UNIX)
endif(MRPT_HAS_SVS)

if(CMAKE_MRPT_HAS_SVS)
	include_directories("${SVS_ROOT_DIR}/src")
	link_directories("${SVS_ROOT_DIR}/bin")
endif(CMAKE_MRPT_HAS_SVS)

# This can only be a system lib:
set(CMAKE_MRPT_HAS_SVS_SYSTEM 0)
if(CMAKE_MRPT_HAS_SVS)
	set(CMAKE_MRPT_HAS_SVS_SYSTEM 1)
endif(CMAKE_MRPT_HAS_SVS)