// This tests evaluating properties of objects.

const obj = {
  foo: 1,
  bar: 0,
}

// Test: the property is a literal.

const one_a = obj["foo"]

assertLessThanOrEq(one_a,    1, "Literal property lookup")
assertGreaterThanOrEq(one_a, 1, "Literal property lookup")

// Test: the property is a variable,
// which must be evaluated before looking it up.

const p = "foo"
const one_b = obj[p]

assertLessThanOrEq(one_b,    1, "Computed property lookup")
assertGreaterThanOrEq(one_b, 1, "Computed property lookup")

// Test: multiple literal properties.

const obj2 = {
  inner: obj,
}

const one_c = obj2.inner["foo"]

assertLessThanOrEq(one_c,    1, "Literal property lookup")
assertGreaterThanOrEq(one_c, 1, "Literal property lookup")

// Test: multiple properties, mix of literal and computed.

const one_d = obj2.inner[p]

assertLessThanOrEq(one_d,    1, "Computed property lookup")
assertGreaterThanOrEq(one_d, 1, "Computed property lookup")
