-
Notifications
You must be signed in to change notification settings - Fork 7
/
sms_test.go
36 lines (31 loc) · 856 Bytes
/
sms_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package gostrutils
import (
"strings"
"testing"
)
func TestSmsCalculateSmsFragmentsSingleLatin(t *testing.T) {
count := SmsCalculateSmsFragments("Hello World")
if count != 1 {
t.Errorf("Expected '1', got '%d'", count)
}
}
func TestSmsCalculateSmsFragmentsSingleUTF8(t *testing.T) {
count := SmsCalculateSmsFragments("Hello World שלום עולם")
if count != 1 {
t.Errorf("Expected '1', got '%d'", count)
}
}
func TestSmsCalculateSmsFragmentsTwoFragmentsLatin(t *testing.T) {
msg := strings.Repeat("abc", 100)
count := SmsCalculateSmsFragments(msg)
if count != 2 {
t.Errorf("Expected 2 messages, got '%d'", count)
}
}
func TestSmsCalculateSmsFragmentsTwoFragmentsUtf8(t *testing.T) {
msg := strings.Repeat("א", 100)
count := SmsCalculateSmsFragments(msg)
if count != 2 {
t.Errorf("Expected 2 messages, got '%d'", count)
}
}