mirror of
https://github.com/MengMengCode/VoCat.git
synced 2026-08-13 03:13:43 +08:00
32 lines
846 B
Go
32 lines
846 B
Go
package device
|
|
|
|
import "testing"
|
|
|
|
func TestParseQMIRegistrationRegisteredRoaming(t *testing.T) {
|
|
output := `
|
|
Registration state: 'registered'
|
|
CS: 'attached'
|
|
PS: 'attached'
|
|
Roaming status: 'on'
|
|
Current PLMN:
|
|
MCC: '460'
|
|
MNC: '1'
|
|
Description: 'UNICOM'
|
|
Full operator code info:
|
|
MCC: '460'
|
|
MNC: '1'
|
|
MNC with PCS digit: 'no'
|
|
`
|
|
result, found := parseQMIRegistration(output)
|
|
if !found || result.Status != 5 || !result.PSAttached || result.PLMN != "46001" || result.Name != "UNICOM" {
|
|
t.Fatalf("registration = %#v, found=%v", result, found)
|
|
}
|
|
}
|
|
|
|
func TestParseQMIRegistrationSearching(t *testing.T) {
|
|
result, found := parseQMIRegistration("Registration state: 'not-registered-searching'\nPS: 'detached'")
|
|
if !found || result.Status != 2 || result.PSAttached {
|
|
t.Fatalf("registration = %#v, found=%v", result, found)
|
|
}
|
|
}
|