-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathencoding-finder-test.perl
More file actions
41 lines (34 loc) · 997 Bytes
/
encoding-finder-test.perl
File metadata and controls
41 lines (34 loc) · 997 Bytes
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
37
38
39
40
#!/usr/bin/perl -w
use strict;
my $software_file = 'encoding-finder.perl';
my $test_failed = 0;
my $iso_1 = `cat text/iso-latin-1_text.txt | perl $software_file`;
if($iso_1 =~ /ISO-Latin-1/i){
print "Test ISO-Latin-1 passed\n";
}else{
print "Test ISO-Latin-1 FAILED!!!\n";
$test_failed++;
}
my $utf_8 = `cat text/utf-8_text.txt | perl $software_file`;
if($utf_8 =~ /utf-8/i){
print "Test utf-8 passed\n";
}else{
print "Test utf-8 FAILED!!!\n";
$test_failed++;
}
my $utf_16le = `cat text/utf-16-le_text.txt | perl $software_file`;
if($utf_16le =~ /utf16-le/i){
print "Test utf-16le passed\n";
}else{
print "Test utf-16le FAILED!!!\n";
$test_failed++;
}
my $utf_16be = `cat text/utf-16-be_text.txt | perl $software_file`;
if($utf_16be =~ /utf16-be/i){
print "Test utf-16be passed\n";
}else{
print "Test utf-16be FAILED!!!\n";
$test_failed++;
}
die "ERROR: $test_failed test failure\/s\n" unless($test_failed == 0);
print "All tests passed successfully. Great job!\n";