Dirichlet function $D:[0;1]\to\mathbb{R}$ is defined by
$$ D(x) = \begin{cases} 1 & \text{if } x \in \mathbb{Q} \\ 0 & \text{if } x \not\in \mathbb{Q} \end{cases}$$
We say that a function $f:E \to \mathbb{R}$ is measurable in measure space $(X,\Sigma)$ iff
$$ \forall c \in \mathbb{R} \;\{ x\in E | f(x) < c \}\in\Sigma.$$
This definition is equivalent to other 3 statements with respectively $\le, \ge, >$ inserted in $f(x) < c$.
Using the statement $ \forall c \in \mathbb{R} \;\{ x\in E | f(x) > c \}\in\Sigma$ it is easy to see that $D$ is measurable by considering cases where $x\le0$, $0<x\le1$ and $x>1$.
But how would I test if a similar function $F:[0;1]\to\mathbb{R}$ is measurable?
$$ F(x) = \begin{cases} e^x & \text{if } x \in \mathbb{Q} \\ xe^x & \text{if } x \not\in \mathbb{Q} \end{cases}$$
P.S. There is a similar post which apparently uses a different definition of measurability.
The functions $x \mapsto e^x$ and $x \mapsto x e^x$ are both continuous, hence measurable (you can also use your criterion to show that they are increasing, hence measurable).
Using the fact that $\mathbb{Q} \cap [0,1]$ is measurable, and that sums and products of measurable functions are measurable, we find that $$ F(x) = \mathbf{1}_{\mathbb{Q} \cap [0,1]} \, e^x + \mathbf{1}_{\mathbb{Q}^c \cap [0,1]} \,x e^x $$ is measurable as well.