---
policy: /ce/unit-test/less-than-equal
logic: /ce/unit-test/less-than-equal/unit-test.logic.yaml
executionTime: 2026-01-14T13:21:16.270942686Z
generationMs: 54
executionMs: 1346
rows:
  - id: Simple-1
    match: true
    status:
      expected: COMPLIANT
      actual: COMPLIANT
    conditionIndex:
      expected: 199
      actual: 199
    conditionText:
      expected: "unitTest(Simple-1): number(0.0) <= number(1.0)"
      actual: "unitTest(Simple-1): number(0.0) <= number(1.0)"
    runtimeError: {}
  - id: Simple-2
    match: true
    status:
      expected: COMPLIANT
      actual: COMPLIANT
    conditionIndex:
      expected: 299
      actual: 299
    conditionText:
      expected: "unitTest(Simple-2): not(number(1.0) <= number(0.0))"
      actual: "unitTest(Simple-2): not(number(1.0) <= number(0.0))"
    runtimeError: {}
  - id: Simple-3
    match: true
    status:
      expected: COMPLIANT
      actual: COMPLIANT
    conditionIndex:
      expected: 399
      actual: 399
    conditionText:
      expected: "unitTest(Simple-3): number(1.0) <= number(1.0)"
      actual: "unitTest(Simple-3): number(1.0) <= number(1.0)"
    runtimeError: {}
  - id: Simple-4
    match: true
    status:
      expected: COMPLIANT
      actual: COMPLIANT
    conditionIndex:
      expected: 499
      actual: 499
    conditionText:
      expected: "unitTest(Simple-4): number(1.0) <= number(1.0000000001)"
      actual: "unitTest(Simple-4): number(1.0) <= number(1.0000000001)"
    runtimeError: {}
  - id: Precision-1
    match: true
    status:
      expected: COMPLIANT
      actual: COMPLIANT
    conditionIndex:
      expected: 599
      actual: 599
    conditionText:
      expected: "unitTest(Precision-1): number(1.111111111222223E9) <= number(1.111111111222224E9)"
      actual: "unitTest(Precision-1): number(1.111111111222223E9) <= number(1.111111111222224E9)"
    runtimeError: {}
  - id: Precision-2
    match: true
    status:
      expected: COMPLIANT
      actual: COMPLIANT
    conditionIndex:
      expected: 699
      actual: 699
    conditionText:
      expected: "unitTest(Precision-2): number(1.1111111112222233E9) <= number(1.1111111112222235E9)"
      actual: "unitTest(Precision-2): number(1.1111111112222233E9) <= number(1.1111111112222235E9)"
    runtimeError: {}
  - id: Precision-3
    match: true
    status:
      expected: COMPLIANT
      actual: COMPLIANT
    conditionIndex:
      expected: 799
      actual: 799
    conditionText:
      expected: "unitTest(Precision-3): number(1.1111111112222235E9) <= number(1.1111111112222235E9)"
      actual: "unitTest(Precision-3): number(1.1111111112222235E9) <= number(1.1111111112222235E9)"
    runtimeError: {}
  - id: Null-1
    match: true
    status:
      expected: COMPLIANT
      actual: COMPLIANT
    conditionIndex:
      expected: 899
      actual: 899
    conditionText:
      expected: "unitTest(Null-1): not(null <= null)"
      actual: "unitTest(Null-1): not(null <= null)"
    runtimeError: {}
  - id: Null-2
    match: true
    status:
      expected: COMPLIANT
      actual: COMPLIANT
    conditionIndex:
      expected: 999
      actual: 999
    conditionText:
      expected: "unitTest(Null-2): not(number(-1.0) <= null)"
      actual: "unitTest(Null-2): not(number(-1.0) <= null)"
    runtimeError: {}
  - id: Null-3
    match: true
    status:
      expected: COMPLIANT
      actual: COMPLIANT
    conditionIndex:
      expected: 1099
      actual: 1099
    conditionText:
      expected: "unitTest(Null-3): not(number(1.0) <= null)"
      actual: "unitTest(Null-3): not(number(1.0) <= null)"
    runtimeError: {}
  - id: Null-4
    match: true
    status:
      expected: COMPLIANT
      actual: COMPLIANT
    conditionIndex:
      expected: 1199
      actual: 1199
    conditionText:
      expected: "unitTest(Null-4): not(null <= number(-1.0))"
      actual: "unitTest(Null-4): not(null <= number(-1.0))"
    runtimeError: {}
  - id: Null-5
    match: true
    status:
      expected: COMPLIANT
      actual: COMPLIANT
    conditionIndex:
      expected: 1299
      actual: 1299
    conditionText:
      expected: "unitTest(Null-5): not(null <= number(1.0))"
      actual: "unitTest(Null-5): not(null <= number(1.0))"
    runtimeError: {}
usedFiles:
  - path: /ce/unit-test/less-than-equal/policy.yaml
    md5Hash: BCB0A619A24AD61671617F45835E971B
    content: |
      ---
      names:
        full: LESS_THAN_EQUAL Unit Tests
        contextual: LESS_THAN_EQUAL
      description: "Unit tests for LESS_THAN_EQUAL operation"
  - path: /ce/unit-test/less-than-equal/unit-test.logic.yaml
    md5Hash: C61CBF3E979E22E5C6D4D568C2896845
    content: |-
      ---
      inputType: CA10__CaAwsInstance__c
      conditions:
        - status: COMPLIANT
          currentStateMessage: Simple-1
          check:
            UNIT_TEST:
              id: Simple-1
              expected:
                text: "unitTest(Simple-1): number(0.0) <= number(1.0)"
              arg:
                LESS_THAN_EQUAL:
                  left:
                    NUMBER: 0
                  right:
                    NUMBER: 1
        - status: COMPLIANT
          currentStateMessage: Simple-2
          check:
            UNIT_TEST:
              id: Simple-2
              expected:
                text: "unitTest(Simple-2): not(number(1.0) <= number(0.0))"
              arg:
                NOT:
                  arg:
                    LESS_THAN_EQUAL:
                      left:
                        NUMBER: 1
                      right:
                        NUMBER: 0
        - status: COMPLIANT
          currentStateMessage: Simple-3
          check:
            UNIT_TEST:
              id: Simple-3
              expected:
                text: "unitTest(Simple-3): number(1.0) <= number(1.0)"
              arg:
                LESS_THAN_EQUAL:
                  left:
                    NUMBER: 1
                  right:
                    NUMBER: 1
        - status: COMPLIANT
          currentStateMessage: Simple-4
          check:
            UNIT_TEST:
              id: Simple-4
              expected:
                text: "unitTest(Simple-4): number(1.0) <= number(1.0000000001)"
              arg:
                LESS_THAN_EQUAL:
                  left:
                    NUMBER: 1
                  right:
                    NUMBER: 1.0000000001
        - status: COMPLIANT
          currentStateMessage: Precision-1
          check:
            UNIT_TEST:
              id: Precision-1
              expected:
                text: "unitTest(Precision-1): number(1.111111111222223E9) <= number(1.111111111222224E9)"
              arg:
                LESS_THAN_EQUAL:
                  left:
                    NUMBER: 1111111111.222223
                  right:
                    NUMBER: 1111111111.222224
        - status: COMPLIANT
          currentStateMessage: Precision-2
          check:
            UNIT_TEST:
              id: Precision-2
              expected:
                text: "unitTest(Precision-2): number(1.1111111112222233E9) <= number(1.1111111112222235E9)"
              arg:
                LESS_THAN_EQUAL:
                  left:
                    NUMBER: 1111111111.2222234
                  right:
                    NUMBER: 1111111111.2222235
        - status: COMPLIANT
          currentStateMessage: Precision-3
          check:
            UNIT_TEST:
              id: Precision-3
              expected:
                text: "unitTest(Precision-3): number(1.1111111112222235E9) <= number(1.1111111112222235E9)"
              arg:
                LESS_THAN_EQUAL:
                  left:
                    NUMBER: 1111111111.22222346
                  right:
                    NUMBER: 1111111111.22222345
        - status: COMPLIANT
          currentStateMessage: Null-1
          check:
            UNIT_TEST:
              id: Null-1
              expected:
                text: "unitTest(Null-1): not(null <= null)"
              arg:
                NOT:
                  arg:
                    LESS_THAN_EQUAL:
                      left:
                        UNIT_TEST_NULL:
                          returnType: NUMBER
                      right:
                        UNIT_TEST_NULL:
                          returnType: NUMBER
        - status: COMPLIANT
          currentStateMessage: Null-2
          check:
            UNIT_TEST:
              id: Null-2
              expected:
                text: "unitTest(Null-2): not(number(-1.0) <= null)"
              arg:
                NOT:
                  arg:
                    LESS_THAN_EQUAL:
                      left:
                        NUMBER: -1
                      right:
                        UNIT_TEST_NULL:
                          returnType: NUMBER
        - status: COMPLIANT
          currentStateMessage: Null-3
          check:
            UNIT_TEST:
              id: Null-3
              expected:
                text: "unitTest(Null-3): not(number(1.0) <= null)"
              arg:
                NOT:
                  arg:
                    LESS_THAN_EQUAL:
                      left:
                        NUMBER: 1
                      right:
                        UNIT_TEST_NULL:
                          returnType: NUMBER
        - status: COMPLIANT
          currentStateMessage: Null-4
          check:
            UNIT_TEST:
              id: Null-4
              expected:
                text: "unitTest(Null-4): not(null <= number(-1.0))"
              arg:
                NOT:
                  arg:
                    LESS_THAN_EQUAL:
                      left:
                        UNIT_TEST_NULL:
                          returnType: NUMBER
                      right:
                        NUMBER: -1
        - status: COMPLIANT
          currentStateMessage: Null-5
          check:
            UNIT_TEST:
              id: Null-5
              expected:
                text: "unitTest(Null-5): not(null <= number(1.0))"
              arg:
                NOT:
                  arg:
                    LESS_THAN_EQUAL:
                      left:
                        UNIT_TEST_NULL:
                          returnType: NUMBER
                      right:
                        NUMBER: 1
      otherwise:
        status: INCOMPLIANT
        currentStateMessage: Test Failed
        remediationMessage: Developer Fix Required
script: |-
  CREATE TEMP FUNCTION mock_ExpectedResult()
  RETURNS ARRAY<STRUCT<
          Id STRING,
          expectedResult STRUCT<status STRING, conditionIndex DECIMAL, conditionText STRING, runtimeError STRING>
      >>
  DETERMINISTIC
  LANGUAGE js
  AS r"""
    return [ {
    "Id" : "Simple-1",
    "expectedResult" : {
      "status" : "COMPLIANT",
      "conditionIndex" : 199,
      "conditionText" : "unitTest(Simple-1): number(0.0) <= number(1.0)",
      "runtimeError" : null
    }
  }, {
    "Id" : "Simple-2",
    "expectedResult" : {
      "status" : "COMPLIANT",
      "conditionIndex" : 299,
      "conditionText" : "unitTest(Simple-2): not(number(1.0) <= number(0.0))",
      "runtimeError" : null
    }
  }, {
    "Id" : "Simple-3",
    "expectedResult" : {
      "status" : "COMPLIANT",
      "conditionIndex" : 399,
      "conditionText" : "unitTest(Simple-3): number(1.0) <= number(1.0)",
      "runtimeError" : null
    }
  }, {
    "Id" : "Simple-4",
    "expectedResult" : {
      "status" : "COMPLIANT",
      "conditionIndex" : 499,
      "conditionText" : "unitTest(Simple-4): number(1.0) <= number(1.0000000001)",
      "runtimeError" : null
    }
  }, {
    "Id" : "Precision-1",
    "expectedResult" : {
      "status" : "COMPLIANT",
      "conditionIndex" : 599,
      "conditionText" : "unitTest(Precision-1): number(1.111111111222223E9) <= number(1.111111111222224E9)",
      "runtimeError" : null
    }
  }, {
    "Id" : "Precision-2",
    "expectedResult" : {
      "status" : "COMPLIANT",
      "conditionIndex" : 699,
      "conditionText" : "unitTest(Precision-2): number(1.1111111112222233E9) <= number(1.1111111112222235E9)",
      "runtimeError" : null
    }
  }, {
    "Id" : "Precision-3",
    "expectedResult" : {
      "status" : "COMPLIANT",
      "conditionIndex" : 799,
      "conditionText" : "unitTest(Precision-3): number(1.1111111112222235E9) <= number(1.1111111112222235E9)",
      "runtimeError" : null
    }
  }, {
    "Id" : "Null-1",
    "expectedResult" : {
      "status" : "COMPLIANT",
      "conditionIndex" : 899,
      "conditionText" : "unitTest(Null-1): not(null <= null)",
      "runtimeError" : null
    }
  }, {
    "Id" : "Null-2",
    "expectedResult" : {
      "status" : "COMPLIANT",
      "conditionIndex" : 999,
      "conditionText" : "unitTest(Null-2): not(number(-1.0) <= null)",
      "runtimeError" : null
    }
  }, {
    "Id" : "Null-3",
    "expectedResult" : {
      "status" : "COMPLIANT",
      "conditionIndex" : 1099,
      "conditionText" : "unitTest(Null-3): not(number(1.0) <= null)",
      "runtimeError" : null
    }
  }, {
    "Id" : "Null-4",
    "expectedResult" : {
      "status" : "COMPLIANT",
      "conditionIndex" : 1199,
      "conditionText" : "unitTest(Null-4): not(null <= number(-1.0))",
      "runtimeError" : null
    }
  }, {
    "Id" : "Null-5",
    "expectedResult" : {
      "status" : "COMPLIANT",
      "conditionIndex" : 1299,
      "conditionText" : "unitTest(Null-5): not(null <= number(1.0))",
      "runtimeError" : null
    }
  } ];
  """;

  CREATE TEMP FUNCTION mock_CA10__CaAwsInstance__c()
  RETURNS ARRAY<STRUCT<
      CA10__disappearanceTime__c TIMESTAMP,
      Id STRING,
      context STRUCT<
          snapshotTime TIMESTAMP
      >
  >>
  DETERMINISTIC
  LANGUAGE js
  AS r"""
    return [ {
    "context" : {
      "snapshotTime" : new Date("2024-01-01T00:00:00.000Z")
    },
    "Id" : "Simple-1"
  }, {
    "context" : {
      "snapshotTime" : new Date("2024-01-01T00:00:00.000Z")
    },
    "Id" : "Simple-2"
  }, {
    "context" : {
      "snapshotTime" : new Date("2024-01-01T00:00:00.000Z")
    },
    "Id" : "Simple-3"
  }, {
    "context" : {
      "snapshotTime" : new Date("2024-01-01T00:00:00.000Z")
    },
    "Id" : "Simple-4"
  }, {
    "context" : {
      "snapshotTime" : new Date("2024-01-01T00:00:00.000Z")
    },
    "Id" : "Precision-1"
  }, {
    "context" : {
      "snapshotTime" : new Date("2024-01-01T00:00:00.000Z")
    },
    "Id" : "Precision-2"
  }, {
    "context" : {
      "snapshotTime" : new Date("2024-01-01T00:00:00.000Z")
    },
    "Id" : "Precision-3"
  }, {
    "context" : {
      "snapshotTime" : new Date("2024-01-01T00:00:00.000Z")
    },
    "Id" : "Null-1"
  }, {
    "context" : {
      "snapshotTime" : new Date("2024-01-01T00:00:00.000Z")
    },
    "Id" : "Null-2"
  }, {
    "context" : {
      "snapshotTime" : new Date("2024-01-01T00:00:00.000Z")
    },
    "Id" : "Null-3"
  }, {
    "context" : {
      "snapshotTime" : new Date("2024-01-01T00:00:00.000Z")
    },
    "Id" : "Null-4"
  }, {
    "context" : {
      "snapshotTime" : new Date("2024-01-01T00:00:00.000Z")
    },
    "Id" : "Null-5"
  } ];
  """;

  CREATE TEMP FUNCTION process_CA10__CaAwsInstance__c(
      obj STRUCT<
          CA10__disappearanceTime__c TIMESTAMP,
          Id STRING
      >,
      snapshotTime TIMESTAMP
  )
  RETURNS STRUCT<status STRING, conditionIndex DECIMAL, conditionText STRING, currentStateMessage STRING, currentStateReferences STRING, remediation STRING, runtimeError STRING>
  DETERMINISTIC
  LANGUAGE js
  AS r"""
      var references1 = [];
      // condition[0], conditionIndex:[0..99]
      references1.push('Deleted From AWS [CA10__disappearanceTime__c]: ' + obj.CA10__disappearanceTime__c);
      if (obj.CA10__disappearanceTime__c != null) {
          return {status: 'DISAPPEARED', conditionIndex: 99, conditionText: "isDisappeared(CA10__disappearanceTime__c)", currentStateMessage: "Object is deleted in the source", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null};
      }
      // condition[1], conditionIndex:[100..199]
      if (obj.Id == 'Simple-1' && (0.0 != null && 1.0 != null && 0.0 <= 1.0)) {
          return {status: 'COMPLIANT', conditionIndex: 199, conditionText: "unitTest(Simple-1): number(0.0) <= number(1.0)", currentStateMessage: "Simple-1", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null};
      }
      // condition[2], conditionIndex:[200..299]
      if (obj.Id == 'Simple-2' && !(1.0 != null && 0.0 != null && 1.0 <= 0.0)) {
          return {status: 'COMPLIANT', conditionIndex: 299, conditionText: "unitTest(Simple-2): not(number(1.0) <= number(0.0))", currentStateMessage: "Simple-2", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null};
      }
      // condition[3], conditionIndex:[300..399]
      if (obj.Id == 'Simple-3' && (1.0 != null && 1.0 != null && 1.0 <= 1.0)) {
          return {status: 'COMPLIANT', conditionIndex: 399, conditionText: "unitTest(Simple-3): number(1.0) <= number(1.0)", currentStateMessage: "Simple-3", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null};
      }
      // condition[4], conditionIndex:[400..499]
      if (obj.Id == 'Simple-4' && (1.0 != null && 1.0000000001 != null && 1.0 <= 1.0000000001)) {
          return {status: 'COMPLIANT', conditionIndex: 499, conditionText: "unitTest(Simple-4): number(1.0) <= number(1.0000000001)", currentStateMessage: "Simple-4", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null};
      }
      // condition[5], conditionIndex:[500..599]
      if (obj.Id == 'Precision-1' && (1.111111111222223E9 != null && 1.111111111222224E9 != null && 1.111111111222223E9 <= 1.111111111222224E9)) {
          return {status: 'COMPLIANT', conditionIndex: 599, conditionText: "unitTest(Precision-1): number(1.111111111222223E9) <= number(1.111111111222224E9)", currentStateMessage: "Precision-1", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null};
      }
      // condition[6], conditionIndex:[600..699]
      if (obj.Id == 'Precision-2' && (1.1111111112222233E9 != null && 1.1111111112222235E9 != null && 1.1111111112222233E9 <= 1.1111111112222235E9)) {
          return {status: 'COMPLIANT', conditionIndex: 699, conditionText: "unitTest(Precision-2): number(1.1111111112222233E9) <= number(1.1111111112222235E9)", currentStateMessage: "Precision-2", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null};
      }
      // condition[7], conditionIndex:[700..799]
      if (obj.Id == 'Precision-3' && (1.1111111112222235E9 != null && 1.1111111112222235E9 != null && 1.1111111112222235E9 <= 1.1111111112222235E9)) {
          return {status: 'COMPLIANT', conditionIndex: 799, conditionText: "unitTest(Precision-3): number(1.1111111112222235E9) <= number(1.1111111112222235E9)", currentStateMessage: "Precision-3", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null};
      }
      // condition[8], conditionIndex:[800..899]
      if (obj.Id == 'Null-1' && !(null != null && null != null && null <= null)) {
          return {status: 'COMPLIANT', conditionIndex: 899, conditionText: "unitTest(Null-1): not(null <= null)", currentStateMessage: "Null-1", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null};
      }
      // condition[9], conditionIndex:[900..999]
      if (obj.Id == 'Null-2' && !(-1.0 != null && null != null && -1.0 <= null)) {
          return {status: 'COMPLIANT', conditionIndex: 999, conditionText: "unitTest(Null-2): not(number(-1.0) <= null)", currentStateMessage: "Null-2", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null};
      }
      // condition[10], conditionIndex:[1000..1099]
      if (obj.Id == 'Null-3' && !(1.0 != null && null != null && 1.0 <= null)) {
          return {status: 'COMPLIANT', conditionIndex: 1099, conditionText: "unitTest(Null-3): not(number(1.0) <= null)", currentStateMessage: "Null-3", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null};
      }
      // condition[11], conditionIndex:[1100..1199]
      if (obj.Id == 'Null-4' && !(null != null && -1.0 != null && null <= -1.0)) {
          return {status: 'COMPLIANT', conditionIndex: 1199, conditionText: "unitTest(Null-4): not(null <= number(-1.0))", currentStateMessage: "Null-4", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null};
      }
      // condition[12], conditionIndex:[1200..1299]
      if (obj.Id == 'Null-5' && !(null != null && 1.0 != null && null <= 1.0)) {
          return {status: 'COMPLIANT', conditionIndex: 1299, conditionText: "unitTest(Null-5): not(null <= number(1.0))", currentStateMessage: "Null-5", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null};
      }
      return {status: 'INCOMPLIANT', conditionIndex: 1300, conditionText: "otherwise", currentStateMessage: "Test Failed", currentStateReferences: references1.join('\n'), remediation: "Developer Fix Required", runtimeError: null};
  """;


  SELECT
    expectedResult.Id as Id,
    IF (
      IFNULL(expectedResult.expectedResult.status, '') = IFNULL(sObject.result.status, '')
      AND IFNULL(expectedResult.expectedResult.conditionIndex, -1) = IFNULL(sObject.result.conditionIndex, -1)
      AND IFNULL(expectedResult.expectedResult.conditionText, '') = IFNULL(sObject.result.conditionText, '')
      AND IFNULL(expectedResult.expectedResult.runtimeError, '') = IFNULL(sObject.result.runtimeError, ''),
      "MATCH",
      "FAIL"
    ) as match,
    expectedResult.expectedResult.status as expectedStatus, sObject.result.status as actualStatus,
    expectedResult.expectedResult.conditionIndex as expectedConditionIndex, sObject.result.conditionIndex as actualConditionIndex,
    expectedResult.expectedResult.conditionText as expectedConditionText, sObject.result.conditionText as actualConditionText,
    expectedResult.expectedResult.runtimeError as expectedRuntimeError, sObject.result.runtimeError as actualRuntimeError
  FROM UNNEST(mock_ExpectedResult()) expectedResult
  LEFT JOIN (
      SELECT
          sObject.CA10__disappearanceTime__c AS CA10__disappearanceTime__c,
          sObject.Id AS Id,
          process_CA10__CaAwsInstance__c(
              STRUCT(
                  sObject.CA10__disappearanceTime__c AS CA10__disappearanceTime__c,
                  sObject.Id AS Id
              ),
              sObject.context.snapshotTime
          ) as result
      FROM UNNEST(mock_CA10__CaAwsInstance__c()) AS sObject
  ) sObject ON sObject.Id = expectedResult.Id;
