(defsuite
  "tw-layout-display"
  (deftest
    "block"
    (assert-equal "display:block" (tw-resolve-layout "block")))
  (deftest
    "inline"
    (assert-equal "display:inline" (tw-resolve-layout "inline")))
  (deftest "flex" (assert-equal "display:flex" (tw-resolve-layout "flex")))
  (deftest "grid" (assert-equal "display:grid" (tw-resolve-layout "grid")))
  (deftest
    "hidden"
    (assert-equal "display:none" (tw-resolve-layout "hidden")))
  (deftest
    "inline-flex"
    (assert-equal "display:inline-flex" (tw-resolve-layout "inline-flex")))
  (deftest
    "inline-block"
    (assert-equal "display:inline-block" (tw-resolve-layout "inline-block")))
  (deftest
    "inline-grid"
    (assert-equal "display:inline-grid" (tw-resolve-layout "inline-grid"))))

(defsuite
  "tw-layout-flex-direction"
  (deftest
    "flex-row"
    (assert-equal "flex-direction:row" (tw-resolve-layout "flex-row")))
  (deftest
    "flex-col"
    (assert-equal "flex-direction:column" (tw-resolve-layout "flex-col")))
  (deftest
    "flex-row-reverse"
    (assert-equal
      "flex-direction:row-reverse"
      (tw-resolve-layout "flex-row-reverse")))
  (deftest
    "flex-col-reverse"
    (assert-equal
      "flex-direction:column-reverse"
      (tw-resolve-layout "flex-col-reverse"))))

(defsuite
  "tw-layout-flex-wrap"
  (deftest
    "flex-wrap"
    (assert-equal "flex-wrap:wrap" (tw-resolve-layout "flex-wrap")))
  (deftest
    "flex-nowrap"
    (assert-equal "flex-wrap:nowrap" (tw-resolve-layout "flex-nowrap")))
  (deftest
    "flex-wrap-reverse"
    (assert-equal
      "flex-wrap:wrap-reverse"
      (tw-resolve-layout "flex-wrap-reverse"))))

(defsuite
  "tw-layout-flex-shorthand"
  (deftest
    "flex-1"
    (assert-equal "flex:1 1 0%" (tw-resolve-layout "flex-1")))
  (deftest
    "flex-auto"
    (assert-equal "flex:1 1 auto" (tw-resolve-layout "flex-auto")))
  (deftest
    "flex-initial"
    (assert-equal "flex:0 1 auto" (tw-resolve-layout "flex-initial")))
  (deftest
    "flex-none"
    (assert-equal "flex:none" (tw-resolve-layout "flex-none"))))

(defsuite
  "tw-layout-justify"
  (deftest
    "justify-center"
    (assert-equal
      "justify-content:center"
      (tw-resolve-layout "justify-center")))
  (deftest
    "justify-between"
    (assert-equal
      "justify-content:space-between"
      (tw-resolve-layout "justify-between")))
  (deftest
    "justify-start"
    (assert-equal
      "justify-content:flex-start"
      (tw-resolve-layout "justify-start")))
  (deftest
    "justify-end"
    (assert-equal
      "justify-content:flex-end"
      (tw-resolve-layout "justify-end")))
  (deftest
    "justify-around"
    (assert-equal
      "justify-content:space-around"
      (tw-resolve-layout "justify-around")))
  (deftest
    "justify-evenly"
    (assert-equal
      "justify-content:space-evenly"
      (tw-resolve-layout "justify-evenly"))))

(defsuite
  "tw-layout-align-items"
  (deftest
    "items-center"
    (assert-equal "align-items:center" (tw-resolve-layout "items-center")))
  (deftest
    "items-start"
    (assert-equal "align-items:flex-start" (tw-resolve-layout "items-start")))
  (deftest
    "items-end"
    (assert-equal "align-items:flex-end" (tw-resolve-layout "items-end")))
  (deftest
    "items-stretch"
    (assert-equal "align-items:stretch" (tw-resolve-layout "items-stretch")))
  (deftest
    "items-baseline"
    (assert-equal "align-items:baseline" (tw-resolve-layout "items-baseline"))))

(defsuite
  "tw-layout-align-self"
  (deftest
    "self-center"
    (assert-equal "align-self:center" (tw-resolve-layout "self-center")))
  (deftest
    "self-auto"
    (assert-equal "align-self:auto" (tw-resolve-layout "self-auto")))
  (deftest
    "self-start"
    (assert-equal "align-self:flex-start" (tw-resolve-layout "self-start")))
  (deftest
    "self-end"
    (assert-equal "align-self:flex-end" (tw-resolve-layout "self-end"))))

(defsuite
  "tw-layout-gap"
  (deftest "gap-0" (assert-equal "gap:0px" (tw-resolve-layout "gap-0")))
  (deftest "gap-1" (assert-equal "gap:0.25rem" (tw-resolve-layout "gap-1")))
  (deftest "gap-2" (assert-equal "gap:0.5rem" (tw-resolve-layout "gap-2")))
  (deftest "gap-4" (assert-equal "gap:1rem" (tw-resolve-layout "gap-4")))
  (deftest "gap-8" (assert-equal "gap:2rem" (tw-resolve-layout "gap-8")))
  (deftest
    "gap-x-2"
    (assert-equal "column-gap:0.5rem" (tw-resolve-layout "gap-x-2")))
  (deftest
    "gap-y-3"
    (assert-equal "row-gap:0.75rem" (tw-resolve-layout "gap-y-3"))))

(defsuite
  "tw-layout-width"
  (deftest "w-full" (assert-equal "width:100%" (tw-resolve-layout "w-full")))
  (deftest "w-auto" (assert-equal "width:auto" (tw-resolve-layout "w-auto")))
  (deftest
    "w-screen"
    (assert-equal "width:100vw" (tw-resolve-layout "w-screen")))
  (deftest "w-4" (assert-equal "width:1rem" (tw-resolve-layout "w-4")))
  (deftest
    "w-0"
    (assert-true (string-contains? (tw-resolve-layout "w-0") "width")))
  (deftest "w-1/2" (assert-equal "width:50%" (tw-resolve-layout "w-1/2"))))

(defsuite
  "tw-layout-height"
  (deftest
    "h-full"
    (assert-equal "height:100%" (tw-resolve-layout "h-full")))
  (deftest
    "h-screen"
    (assert-equal "height:100vh" (tw-resolve-layout "h-screen")))
  (deftest
    "h-auto"
    (assert-equal "height:auto" (tw-resolve-layout "h-auto")))
  (deftest "h-4" (assert-equal "height:1rem" (tw-resolve-layout "h-4")))
  (deftest "h-8" (assert-equal "height:2rem" (tw-resolve-layout "h-8"))))

(defsuite
  "tw-layout-max-min-width"
  (deftest
    "max-w-full"
    (assert-equal "max-width:100%" (tw-resolve-layout "max-w-full")))
  (deftest
    "max-w-none"
    (assert-equal "max-width:none" (tw-resolve-layout "max-w-none")))
  (deftest
    "min-w-0"
    (assert-equal "min-width:0px" (tw-resolve-layout "min-w-0")))
  (deftest
    "min-w-full"
    (assert-equal "min-width:100%" (tw-resolve-layout "min-w-full"))))

(defsuite
  "tw-layout-overflow"
  (deftest
    "overflow-hidden"
    (assert-equal "overflow:hidden" (tw-resolve-layout "overflow-hidden")))
  (deftest
    "overflow-auto"
    (assert-equal "overflow:auto" (tw-resolve-layout "overflow-auto")))
  (deftest
    "overflow-scroll"
    (assert-equal "overflow:scroll" (tw-resolve-layout "overflow-scroll")))
  (deftest
    "overflow-visible"
    (assert-equal "overflow:visible" (tw-resolve-layout "overflow-visible")))
  (deftest
    "overflow-x-auto"
    (assert-equal "overflow-x:auto" (tw-resolve-layout "overflow-x-auto")))
  (deftest
    "overflow-y-hidden"
    (assert-equal "overflow-y:hidden" (tw-resolve-layout "overflow-y-hidden"))))

(defsuite
  "tw-layout-position"
  (deftest
    "relative"
    (assert-equal "position:relative" (tw-resolve-layout "relative")))
  (deftest
    "absolute"
    (assert-equal "position:absolute" (tw-resolve-layout "absolute")))
  (deftest
    "fixed"
    (assert-equal "position:fixed" (tw-resolve-layout "fixed")))
  (deftest
    "sticky"
    (assert-equal "position:sticky" (tw-resolve-layout "sticky")))
  (deftest
    "static"
    (assert-equal "position:static" (tw-resolve-layout "static"))))

(defsuite
  "tw-layout-inset"
  (deftest
    "inset-0"
    (assert-equal "inset:0px" (tw-resolve-layout "inset-0")))
  (deftest "top-0" (assert-equal "top:0px" (tw-resolve-layout "top-0")))
  (deftest
    "bottom-0"
    (assert-equal "bottom:0px" (tw-resolve-layout "bottom-0")))
  (deftest "left-0" (assert-equal "left:0px" (tw-resolve-layout "left-0")))
  (deftest
    "right-0"
    (assert-equal "right:0px" (tw-resolve-layout "right-0")))
  (deftest "top-4" (assert-equal "top:1rem" (tw-resolve-layout "top-4"))))

(defsuite
  "tw-layout-z-index"
  (deftest "z-0" (assert-equal "z-index:0" (tw-resolve-layout "z-0")))
  (deftest "z-10" (assert-equal "z-index:10" (tw-resolve-layout "z-10")))
  (deftest "z-20" (assert-equal "z-index:20" (tw-resolve-layout "z-20")))
  (deftest "z-50" (assert-equal "z-index:50" (tw-resolve-layout "z-50")))
  (deftest
    "z-auto"
    (assert-equal "z-index:auto" (tw-resolve-layout "z-auto"))))

(defsuite
  "tw-layout-order"
  (deftest "order-1" (assert-equal "order:1" (tw-resolve-layout "order-1")))
  (deftest
    "order-first"
    (assert-equal "order:-9999" (tw-resolve-layout "order-first")))
  (deftest
    "order-last"
    (assert-equal "order:9999" (tw-resolve-layout "order-last")))
  (deftest
    "order-none"
    (assert-equal "order:0" (tw-resolve-layout "order-none"))))

(defsuite
  "tw-layout-unrecognized"
  (deftest
    "unknown token returns nil"
    (assert-nil (tw-resolve-layout "not-a-real-token")))
  (deftest "empty string returns nil" (assert-nil (tw-resolve-layout ""))))

(defsuite
  "tw-layout-constants"
  (deftest
    "tw-spacing-props is a dict"
    (assert-true (dict? tw-spacing-props)))
  (deftest "tw-displays is a dict" (assert-true (dict? tw-displays)))
  (deftest "tw-max-widths is a dict" (assert-true (dict? tw-max-widths)))
  (deftest "tw-min-widths is a dict" (assert-true (dict? tw-min-widths))))
