  Gromov (2001) and Sturm (2003) proved that any four points in a
$\mathrm{CAT}(0)$ space satisfy a certain family of inequalities. We call those
inequalities the $\boxtimes$-inequalities, following the notation used by
Gromov. In this paper, we prove that a metric space $X$ containing at most five
points admits an isometric embedding into a $\mathrm{CAT}(0)$ space if and only
if any four points in $X$ satisfy the $\boxtimes$-inequalities. To prove this,
we introduce a new family of necessary conditions for a metric space to admit
an isometric embedding into a $\mathrm{CAT}(0)$ space by modifying and
generalizing Gromov's cycle conditions. Furthermore, we prove that if a metric
space satisfies all those necessary conditions, then it admits an isometric
embedding into a $\mathrm{CAT}(0)$ space. This work presents a new approach to
characterizing those metric spaces that admit an isometric embedding into a
$\mathrm{CAT}(0)$ space.
