Quantum nonlocality test for continuous-variable states with dichotomic observables