  It is well known that Bell inequality supporting the local realism can be
violated in quantum mechanics. Numerous tests of such a violation have been
demonstrated with bipartite entanglements. Using spectral jointmeasurements of
the qubits, we here propose a scheme to test the tripartite Mermin inequality
(a three-qubit Bell-type inequality) with three qubits dispersively-coupled to
a driven cavity. First, we show how to generate a three-qubit
Greenberger-Horne-Zeilinger (GHZ) state by only one-step quantum operation.
Then, spectral joint-measurements are introduced to directly confirm such a
tripartite entanglement. Assisted by a series of single-qubit operations, these
measurements are further utilized to test the Mermin inequality. The
feasibility of the proposal is robustly demonstrated by the present numerical
experiments.
