  We analyze a discrimination problem of a single-qubit unitary gate with two
candidates, where the candidates are not provided with their classical
description, but their quantum sample is. The target gate is chosen equally
among the candidates. We obtain the optimal protocol that maximizes the
expected success probability, assuming the Haar distribution for the
candidates. This problem is originally introduced in Hillery et al. (J. Mod.
Opt. 2010) which provides a protocol achieving 7/8 in the expected success
probability based on the ``unitary comparison" protocol of Andersson et al. (J.
Phys. A 2003). The optimality of the protocol has been an open question since
then. We prove the optimality of the comparison protocol, implying that only
one of the two samples (one for each candidate) is needed to achieve an optimal
discrimination. The optimization includes protocols outside the scope of
quantum testers due to the dynamic ordering of the sample and target gates
within a given protocol.
