wlanutilities/wlanwizard/t_wlanwizard/ut/testwlanwizard.cpp
author hgs
Thu, 24 Jun 2010 10:49:51 +0300
changeset 39 7b3e49e4608a
parent 31 e8f4211554fb
permissions -rw-r--r--
201025
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
31
hgs
parents:
diff changeset
     1
/*
hgs
parents:
diff changeset
     2
 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
hgs
parents:
diff changeset
     3
 * All rights reserved.
hgs
parents:
diff changeset
     4
 * This component and the accompanying materials are made available
hgs
parents:
diff changeset
     5
 * under the terms of "Eclipse Public License v1.0"
hgs
parents:
diff changeset
     6
 * which accompanies this distribution, and is available
hgs
parents:
diff changeset
     7
 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
hgs
parents:
diff changeset
     8
 *
hgs
parents:
diff changeset
     9
 * Initial Contributors:
hgs
parents:
diff changeset
    10
 * Nokia Corporation - initial contribution.
hgs
parents:
diff changeset
    11
 *
hgs
parents:
diff changeset
    12
 * Contributors:
hgs
parents:
diff changeset
    13
 *
hgs
parents:
diff changeset
    14
 * Description:
hgs
parents:
diff changeset
    15
 * This is the source file for testing Wlan Wizard library.
hgs
parents:
diff changeset
    16
 */
hgs
parents:
diff changeset
    17
hgs
parents:
diff changeset
    18
// System includes
hgs
parents:
diff changeset
    19
#include <QtCore>
hgs
parents:
diff changeset
    20
#include <QTest>
hgs
parents:
diff changeset
    21
hgs
parents:
diff changeset
    22
// User includes
hgs
parents:
diff changeset
    23
#include "testwlanwizard.h"
hgs
parents:
diff changeset
    24
#include "wlanwizardutils.h"
hgs
parents:
diff changeset
    25
hgs
parents:
diff changeset
    26
// External function prototypes
hgs
parents:
diff changeset
    27
hgs
parents:
diff changeset
    28
// Local constants
hgs
parents:
diff changeset
    29
hgs
parents:
diff changeset
    30
// ======== LOCAL FUNCTIONS ========
hgs
parents:
diff changeset
    31
hgs
parents:
diff changeset
    32
// ======== MEMBER FUNCTIONS ========
hgs
parents:
diff changeset
    33
hgs
parents:
diff changeset
    34
// ---------------------------------------------------------
hgs
parents:
diff changeset
    35
// FRAMEWORK FUNCTIONS
hgs
parents:
diff changeset
    36
// ---------------------------------------------------------
hgs
parents:
diff changeset
    37
hgs
parents:
diff changeset
    38
/**
hgs
parents:
diff changeset
    39
 * This function will be called before the first test function is executed.
hgs
parents:
diff changeset
    40
 */
hgs
parents:
diff changeset
    41
void TestWlanWizard::initTestCase()
hgs
parents:
diff changeset
    42
{
hgs
parents:
diff changeset
    43
hgs
parents:
diff changeset
    44
}
hgs
parents:
diff changeset
    45
hgs
parents:
diff changeset
    46
/**
hgs
parents:
diff changeset
    47
 * This function will be called after the last test function was executed.
hgs
parents:
diff changeset
    48
 */
hgs
parents:
diff changeset
    49
void TestWlanWizard::cleanupTestCase()
hgs
parents:
diff changeset
    50
{
hgs
parents:
diff changeset
    51
}
hgs
parents:
diff changeset
    52
hgs
parents:
diff changeset
    53
/**
hgs
parents:
diff changeset
    54
 * This function will be called before each test function is executed.
hgs
parents:
diff changeset
    55
 */
hgs
parents:
diff changeset
    56
void TestWlanWizard::init()
hgs
parents:
diff changeset
    57
{
hgs
parents:
diff changeset
    58
hgs
parents:
diff changeset
    59
}
hgs
parents:
diff changeset
    60
hgs
parents:
diff changeset
    61
/**
hgs
parents:
diff changeset
    62
 * This function will be called after each test function is executed.
hgs
parents:
diff changeset
    63
 */
hgs
parents:
diff changeset
    64
void TestWlanWizard::cleanup()
hgs
parents:
diff changeset
    65
{
hgs
parents:
diff changeset
    66
hgs
parents:
diff changeset
    67
}
hgs
parents:
diff changeset
    68
hgs
parents:
diff changeset
    69
// ---------------------------------------------------------
hgs
parents:
diff changeset
    70
// TEST CASES
hgs
parents:
diff changeset
    71
// ---------------------------------------------------------
hgs
parents:
diff changeset
    72
hgs
parents:
diff changeset
    73
hgs
parents:
diff changeset
    74
void TestWlanWizard::testWepHex64Valid()
hgs
parents:
diff changeset
    75
{
hgs
parents:
diff changeset
    76
    QString key("a0cd9fACDF");
hgs
parents:
diff changeset
    77
    WlanWizardUtils::KeyStatus status = WlanWizardUtils::validateWepKey(key);
hgs
parents:
diff changeset
    78
    QCOMPARE(status, WlanWizardUtils::KeyStatusOk);
hgs
parents:
diff changeset
    79
}
hgs
parents:
diff changeset
    80
hgs
parents:
diff changeset
    81
void TestWlanWizard::testWepHex128Valid()
hgs
parents:
diff changeset
    82
{
hgs
parents:
diff changeset
    83
    QString key("ABCDEFabcdef0123456789AAAA");
hgs
parents:
diff changeset
    84
    WlanWizardUtils::KeyStatus status = WlanWizardUtils::validateWepKey(key);
hgs
parents:
diff changeset
    85
    QCOMPARE(status, WlanWizardUtils::KeyStatusOk);
hgs
parents:
diff changeset
    86
}
hgs
parents:
diff changeset
    87
hgs
parents:
diff changeset
    88
void TestWlanWizard::testWepHexInvalidCharacters()
hgs
parents:
diff changeset
    89
{
hgs
parents:
diff changeset
    90
    QString key("wlanwizard");
hgs
parents:
diff changeset
    91
    WlanWizardUtils::KeyStatus status = WlanWizardUtils::validateWepKey(key);
hgs
parents:
diff changeset
    92
    QCOMPARE(status, WlanWizardUtils::KeyStatusIllegalCharacters);
hgs
parents:
diff changeset
    93
}
hgs
parents:
diff changeset
    94
hgs
parents:
diff changeset
    95
void TestWlanWizard::testWepAscii64Valid()
hgs
parents:
diff changeset
    96
{
hgs
parents:
diff changeset
    97
    QString key("testi");
hgs
parents:
diff changeset
    98
    WlanWizardUtils::KeyStatus status = WlanWizardUtils::validateWepKey(key);
hgs
parents:
diff changeset
    99
    QCOMPARE(status, WlanWizardUtils::KeyStatusOk);
hgs
parents:
diff changeset
   100
}
hgs
parents:
diff changeset
   101
hgs
parents:
diff changeset
   102
void TestWlanWizard::testWepAscii128Valid()
hgs
parents:
diff changeset
   103
{
hgs
parents:
diff changeset
   104
    QString key("wlanwizardjee");
hgs
parents:
diff changeset
   105
    WlanWizardUtils::KeyStatus status = WlanWizardUtils::validateWepKey(key);
hgs
parents:
diff changeset
   106
    QCOMPARE(status, WlanWizardUtils::KeyStatusOk);
hgs
parents:
diff changeset
   107
}
hgs
parents:
diff changeset
   108
hgs
parents:
diff changeset
   109
void TestWlanWizard::testWepAsciiInvalidCharacters()
hgs
parents:
diff changeset
   110
{
hgs
parents:
diff changeset
   111
    QString key("wlanwizardje");
hgs
parents:
diff changeset
   112
    key.append(QChar(31));
hgs
parents:
diff changeset
   113
    WlanWizardUtils::KeyStatus status = WlanWizardUtils::validateWepKey(key);
hgs
parents:
diff changeset
   114
    QCOMPARE(status, WlanWizardUtils::KeyStatusIllegalCharacters);
hgs
parents:
diff changeset
   115
}
hgs
parents:
diff changeset
   116
hgs
parents:
diff changeset
   117
void TestWlanWizard::testWepLength9Invalid()
hgs
parents:
diff changeset
   118
{
hgs
parents:
diff changeset
   119
    QString key("123456789");
hgs
parents:
diff changeset
   120
    WlanWizardUtils::KeyStatus status = WlanWizardUtils::validateWepKey(key);
hgs
parents:
diff changeset
   121
    QCOMPARE(status, WlanWizardUtils::KeyStatusWepInvalidLength);
hgs
parents:
diff changeset
   122
}
hgs
parents:
diff changeset
   123
hgs
parents:
diff changeset
   124
void TestWlanWizard::testWepLength11Invalid()
hgs
parents:
diff changeset
   125
{
hgs
parents:
diff changeset
   126
    QString key("12345678901");
hgs
parents:
diff changeset
   127
    WlanWizardUtils::KeyStatus status = WlanWizardUtils::validateWepKey(key);
hgs
parents:
diff changeset
   128
    QCOMPARE(status, WlanWizardUtils::KeyStatusWepInvalidLength);
hgs
parents:
diff changeset
   129
}
hgs
parents:
diff changeset
   130
hgs
parents:
diff changeset
   131
void TestWlanWizard::testWepLength25Invalid()
hgs
parents:
diff changeset
   132
{
hgs
parents:
diff changeset
   133
    QString key("1234567890123456789012345");
hgs
parents:
diff changeset
   134
    WlanWizardUtils::KeyStatus status = WlanWizardUtils::validateWepKey(key);
hgs
parents:
diff changeset
   135
    QCOMPARE(status, WlanWizardUtils::KeyStatusWepInvalidLength);
hgs
parents:
diff changeset
   136
}
hgs
parents:
diff changeset
   137
hgs
parents:
diff changeset
   138
void TestWlanWizard::testWepLength27Invalid()
hgs
parents:
diff changeset
   139
{
hgs
parents:
diff changeset
   140
    QString key("123456789012345678901234567");
hgs
parents:
diff changeset
   141
    WlanWizardUtils::KeyStatus status = WlanWizardUtils::validateWepKey(key);
hgs
parents:
diff changeset
   142
    QCOMPARE(status, WlanWizardUtils::KeyStatusWepInvalidLength);
hgs
parents:
diff changeset
   143
}
hgs
parents:
diff changeset
   144
hgs
parents:
diff changeset
   145
void TestWlanWizard::testWepLength4Invalid()
hgs
parents:
diff changeset
   146
{
hgs
parents:
diff changeset
   147
    QString key("1234");
hgs
parents:
diff changeset
   148
    WlanWizardUtils::KeyStatus status = WlanWizardUtils::validateWepKey(key);
hgs
parents:
diff changeset
   149
    QCOMPARE(status, WlanWizardUtils::KeyStatusWepInvalidLength);
hgs
parents:
diff changeset
   150
}
hgs
parents:
diff changeset
   151
hgs
parents:
diff changeset
   152
void TestWlanWizard::testWepLength6Invalid()
hgs
parents:
diff changeset
   153
{
hgs
parents:
diff changeset
   154
    QString key("123456");
hgs
parents:
diff changeset
   155
    WlanWizardUtils::KeyStatus status = WlanWizardUtils::validateWepKey(key);
hgs
parents:
diff changeset
   156
    QCOMPARE(status, WlanWizardUtils::KeyStatusWepInvalidLength);
hgs
parents:
diff changeset
   157
}
hgs
parents:
diff changeset
   158
hgs
parents:
diff changeset
   159
void TestWlanWizard::testWepLength12Invalid()
hgs
parents:
diff changeset
   160
{
hgs
parents:
diff changeset
   161
    QString key("123456789012");
hgs
parents:
diff changeset
   162
    WlanWizardUtils::KeyStatus status = WlanWizardUtils::validateWepKey(key);
hgs
parents:
diff changeset
   163
    QCOMPARE(status, WlanWizardUtils::KeyStatusWepInvalidLength);
hgs
parents:
diff changeset
   164
}
hgs
parents:
diff changeset
   165
hgs
parents:
diff changeset
   166
void TestWlanWizard::testWepLength14Invalid()
hgs
parents:
diff changeset
   167
{
hgs
parents:
diff changeset
   168
    QString key("12345678901234");
hgs
parents:
diff changeset
   169
    WlanWizardUtils::KeyStatus status = WlanWizardUtils::validateWepKey(key);
hgs
parents:
diff changeset
   170
    QCOMPARE(status, WlanWizardUtils::KeyStatusWepInvalidLength);
hgs
parents:
diff changeset
   171
}
hgs
parents:
diff changeset
   172
hgs
parents:
diff changeset
   173
// ----------------------------------------------------------------------------
hgs
parents:
diff changeset
   174
// WPA test cases
hgs
parents:
diff changeset
   175
// ----------------------------------------------------------------------------
hgs
parents:
diff changeset
   176
void TestWlanWizard::testWpaHexValid()
hgs
parents:
diff changeset
   177
{
hgs
parents:
diff changeset
   178
    QString key("1234567890123456789012345678abcdefabcdefabcdefABCDEFABCDEFABCDEF");
hgs
parents:
diff changeset
   179
    WlanWizardUtils::KeyStatus status = WlanWizardUtils::validateWpaKey(key);
hgs
parents:
diff changeset
   180
    QCOMPARE(status, WlanWizardUtils::KeyStatusOk);
hgs
parents:
diff changeset
   181
}
hgs
parents:
diff changeset
   182
hgs
parents:
diff changeset
   183
void TestWlanWizard::testWpaHexInvalidCharacters()
hgs
parents:
diff changeset
   184
{
hgs
parents:
diff changeset
   185
    QString key("abcdefabcdefabcdefABCDEFABCDEFABCDEF123456789012345678901234567G");
hgs
parents:
diff changeset
   186
    WlanWizardUtils::KeyStatus status = WlanWizardUtils::validateWpaKey(key);
hgs
parents:
diff changeset
   187
    QCOMPARE(status, WlanWizardUtils::KeyStatusIllegalCharacters);
hgs
parents:
diff changeset
   188
}
hgs
parents:
diff changeset
   189
void TestWlanWizard::testWpaAsciiLength8Valid()
hgs
parents:
diff changeset
   190
{
hgs
parents:
diff changeset
   191
    QString key("ictsucks");
hgs
parents:
diff changeset
   192
    WlanWizardUtils::KeyStatus status = WlanWizardUtils::validateWpaKey(key);
hgs
parents:
diff changeset
   193
    QCOMPARE(status, WlanWizardUtils::KeyStatusOk);
hgs
parents:
diff changeset
   194
}
hgs
parents:
diff changeset
   195
hgs
parents:
diff changeset
   196
void TestWlanWizard::testWpaAsciiLength63Valid()
hgs
parents:
diff changeset
   197
{
hgs
parents:
diff changeset
   198
    QString key("zxcvbnm,.-asdfghjkl'qwertyuiop1234567890qwertyuiopzxcvbnm,.-123");
hgs
parents:
diff changeset
   199
    WlanWizardUtils::KeyStatus status = WlanWizardUtils::validateWpaKey(key);
hgs
parents:
diff changeset
   200
    QCOMPARE(status, WlanWizardUtils::KeyStatusOk);
hgs
parents:
diff changeset
   201
}
hgs
parents:
diff changeset
   202
hgs
parents:
diff changeset
   203
void TestWlanWizard::testWpaAsciiLength64Invalid()
hgs
parents:
diff changeset
   204
{
hgs
parents:
diff changeset
   205
    QString key("zxcvbnm,.-asdfghjkl'qwertyuiop1234567890qwertyuiopzxcvbnm,.-1234");
hgs
parents:
diff changeset
   206
    WlanWizardUtils::KeyStatus status = WlanWizardUtils::validateWpaKey(key);
hgs
parents:
diff changeset
   207
    QCOMPARE(status, WlanWizardUtils::KeyStatusIllegalCharacters);  
hgs
parents:
diff changeset
   208
}
hgs
parents:
diff changeset
   209
hgs
parents:
diff changeset
   210
void TestWlanWizard::testWpaAsciiInvalidCharacters()
hgs
parents:
diff changeset
   211
{
hgs
parents:
diff changeset
   212
    QString key("wizardrules");
hgs
parents:
diff changeset
   213
    key.append(QChar(127));
hgs
parents:
diff changeset
   214
    WlanWizardUtils::KeyStatus status = WlanWizardUtils::validateWpaKey(key);
hgs
parents:
diff changeset
   215
    QCOMPARE(status, WlanWizardUtils::KeyStatusIllegalCharacters);
hgs
parents:
diff changeset
   216
}
hgs
parents:
diff changeset
   217
hgs
parents:
diff changeset
   218
void TestWlanWizard::testWpaLength7Invalid()
hgs
parents:
diff changeset
   219
{
hgs
parents:
diff changeset
   220
    QString key("wizards");
hgs
parents:
diff changeset
   221
    WlanWizardUtils::KeyStatus status = WlanWizardUtils::validateWpaKey(key);
hgs
parents:
diff changeset
   222
    QCOMPARE(status, WlanWizardUtils::KeyStatusWpaTooShort);
hgs
parents:
diff changeset
   223
}
hgs
parents:
diff changeset
   224
hgs
parents:
diff changeset
   225
void TestWlanWizard::testWpaLength65Invalid()
hgs
parents:
diff changeset
   226
{
hgs
parents:
diff changeset
   227
    QString key("zxcvbnm,.-asdfghjkl'qwertyuiop1234567890qwertyuiopzxcvbnm,.-12345");
hgs
parents:
diff changeset
   228
    WlanWizardUtils::KeyStatus status = WlanWizardUtils::validateWpaKey(key);
hgs
parents:
diff changeset
   229
    QCOMPARE(status, WlanWizardUtils::KeyStatusWpaTooLong);  
hgs
parents:
diff changeset
   230
}
hgs
parents:
diff changeset
   231
hgs
parents:
diff changeset
   232
hgs
parents:
diff changeset
   233
// ----------------------------------------------------------------------------
hgs
parents:
diff changeset
   234
// ASCII test cases
hgs
parents:
diff changeset
   235
// ----------------------------------------------------------------------------
hgs
parents:
diff changeset
   236
void TestWlanWizard::testAsciiValidCharacters()
hgs
parents:
diff changeset
   237
{
hgs
parents:
diff changeset
   238
    QString key;
hgs
parents:
diff changeset
   239
    for (int i = 32 ; i <= 126 ; i++){
hgs
parents:
diff changeset
   240
        key.append(QChar(i));
hgs
parents:
diff changeset
   241
    }
hgs
parents:
diff changeset
   242
    WlanWizardUtils::KeyStatus status = WlanWizardUtils::isAscii(key);
hgs
parents:
diff changeset
   243
    QCOMPARE(status, WlanWizardUtils::KeyStatusOk);
hgs
parents:
diff changeset
   244
}
hgs
parents:
diff changeset
   245
hgs
parents:
diff changeset
   246
void TestWlanWizard::testAsciiInvalidCharactersLower()
hgs
parents:
diff changeset
   247
{
hgs
parents:
diff changeset
   248
    QString key("wizardrules");
hgs
parents:
diff changeset
   249
    key.append(QChar(31));
hgs
parents:
diff changeset
   250
    WlanWizardUtils::KeyStatus status = WlanWizardUtils::isAscii(key);
hgs
parents:
diff changeset
   251
    QCOMPARE(status, WlanWizardUtils::KeyStatusIllegalCharacters);
hgs
parents:
diff changeset
   252
}
hgs
parents:
diff changeset
   253
hgs
parents:
diff changeset
   254
void TestWlanWizard::testAsciiInvalidCharactersUpper()
hgs
parents:
diff changeset
   255
{
hgs
parents:
diff changeset
   256
    QString key("wizardrules");
hgs
parents:
diff changeset
   257
    key.append(QChar(127));
hgs
parents:
diff changeset
   258
    WlanWizardUtils::KeyStatus status = WlanWizardUtils::isAscii(key);
hgs
parents:
diff changeset
   259
    QCOMPARE(status, WlanWizardUtils::KeyStatusIllegalCharacters);
hgs
parents:
diff changeset
   260
}
hgs
parents:
diff changeset
   261
hgs
parents:
diff changeset
   262
hgs
parents:
diff changeset
   263
// ----------------------------------------------------------------------------
hgs
parents:
diff changeset
   264
// HEX test cases
hgs
parents:
diff changeset
   265
// ----------------------------------------------------------------------------
hgs
parents:
diff changeset
   266
void TestWlanWizard::testHexValidCharacters()
hgs
parents:
diff changeset
   267
{
hgs
parents:
diff changeset
   268
    QString key("abcdefABCDEF1234567890");
hgs
parents:
diff changeset
   269
    WlanWizardUtils::KeyStatus status = WlanWizardUtils::isHex(key);
hgs
parents:
diff changeset
   270
    QCOMPARE(status, WlanWizardUtils::KeyStatusOk);   
hgs
parents:
diff changeset
   271
}
hgs
parents:
diff changeset
   272
hgs
parents:
diff changeset
   273
void TestWlanWizard::testHexInvalidCharactersDigitLower()
hgs
parents:
diff changeset
   274
{
hgs
parents:
diff changeset
   275
    QString key("afAF09");
hgs
parents:
diff changeset
   276
    key.append(QChar(47));
hgs
parents:
diff changeset
   277
    WlanWizardUtils::KeyStatus status = WlanWizardUtils::isHex(key);
hgs
parents:
diff changeset
   278
    QCOMPARE(status, WlanWizardUtils::KeyStatusIllegalCharacters);   
hgs
parents:
diff changeset
   279
}
hgs
parents:
diff changeset
   280
hgs
parents:
diff changeset
   281
void TestWlanWizard::testHexInvalidCharactersDigitUpper()
hgs
parents:
diff changeset
   282
{
hgs
parents:
diff changeset
   283
    QString key("abc");
hgs
parents:
diff changeset
   284
    key.append(QChar(58));
hgs
parents:
diff changeset
   285
    WlanWizardUtils::KeyStatus status = WlanWizardUtils::isHex(key);
hgs
parents:
diff changeset
   286
    QCOMPARE(status, WlanWizardUtils::KeyStatusIllegalCharacters);
hgs
parents:
diff changeset
   287
}
hgs
parents:
diff changeset
   288
hgs
parents:
diff changeset
   289
void TestWlanWizard::testHexInvalidCharacters_a_Lower()
hgs
parents:
diff changeset
   290
{
hgs
parents:
diff changeset
   291
    QString key("abc");
hgs
parents:
diff changeset
   292
    key.append(QChar(96));
hgs
parents:
diff changeset
   293
    WlanWizardUtils::KeyStatus status = WlanWizardUtils::isHex(key);
hgs
parents:
diff changeset
   294
    QCOMPARE(status, WlanWizardUtils::KeyStatusIllegalCharacters);
hgs
parents:
diff changeset
   295
}
hgs
parents:
diff changeset
   296
hgs
parents:
diff changeset
   297
void TestWlanWizard::testHexInvalidCharacters_f_Upper()
hgs
parents:
diff changeset
   298
{
hgs
parents:
diff changeset
   299
    QString key("abc");
hgs
parents:
diff changeset
   300
    key.append(QChar(103));
hgs
parents:
diff changeset
   301
    WlanWizardUtils::KeyStatus status = WlanWizardUtils::isHex(key);
hgs
parents:
diff changeset
   302
    QCOMPARE(status, WlanWizardUtils::KeyStatusIllegalCharacters);
hgs
parents:
diff changeset
   303
}
hgs
parents:
diff changeset
   304
hgs
parents:
diff changeset
   305
void TestWlanWizard::testHexInvalidCharacters_A_Lower()
hgs
parents:
diff changeset
   306
{
hgs
parents:
diff changeset
   307
    QString key("abc");
hgs
parents:
diff changeset
   308
    key.append(QChar(64));
hgs
parents:
diff changeset
   309
    WlanWizardUtils::KeyStatus status = WlanWizardUtils::isHex(key);
hgs
parents:
diff changeset
   310
    QCOMPARE(status, WlanWizardUtils::KeyStatusIllegalCharacters);
hgs
parents:
diff changeset
   311
}
hgs
parents:
diff changeset
   312
hgs
parents:
diff changeset
   313
void TestWlanWizard::testHexInvalidCharacters_F_Upper()
hgs
parents:
diff changeset
   314
{
hgs
parents:
diff changeset
   315
    QString key("abc");
hgs
parents:
diff changeset
   316
    key.append(QChar(71));
hgs
parents:
diff changeset
   317
    WlanWizardUtils::KeyStatus status = WlanWizardUtils::isHex(key);
hgs
parents:
diff changeset
   318
    QCOMPARE(status, WlanWizardUtils::KeyStatusIllegalCharacters);
hgs
parents:
diff changeset
   319
}
39
hgs
parents: 31
diff changeset
   320
hgs
parents: 31
diff changeset
   321
void TestWlanWizard::testSsidValidCharacters()
hgs
parents: 31
diff changeset
   322
{
hgs
parents: 31
diff changeset
   323
    QString key("12345678901234567890123456789012");
hgs
parents: 31
diff changeset
   324
    WlanWizardUtils::SsidStatus status = WlanWizardUtils::validateSsid(key);
hgs
parents: 31
diff changeset
   325
    QCOMPARE(status, WlanWizardUtils::SsidStatusOk);
hgs
parents: 31
diff changeset
   326
}
hgs
parents: 31
diff changeset
   327
hgs
parents: 31
diff changeset
   328
void TestWlanWizard::testSsidValidCharacters2()
hgs
parents: 31
diff changeset
   329
{
hgs
parents: 31
diff changeset
   330
    QString key("1");
hgs
parents: 31
diff changeset
   331
    WlanWizardUtils::SsidStatus status = WlanWizardUtils::validateSsid(key);
hgs
parents: 31
diff changeset
   332
    QCOMPARE(status, WlanWizardUtils::SsidStatusOk);
hgs
parents: 31
diff changeset
   333
}
hgs
parents: 31
diff changeset
   334
hgs
parents: 31
diff changeset
   335
void TestWlanWizard::testSsidInvalidTooShort()
hgs
parents: 31
diff changeset
   336
{
hgs
parents: 31
diff changeset
   337
    QString key("");
hgs
parents: 31
diff changeset
   338
    WlanWizardUtils::SsidStatus status = WlanWizardUtils::validateSsid(key);
hgs
parents: 31
diff changeset
   339
    QCOMPARE(status, WlanWizardUtils::SsidStatusInvalidLength);
hgs
parents: 31
diff changeset
   340
}
hgs
parents: 31
diff changeset
   341
hgs
parents: 31
diff changeset
   342
void TestWlanWizard::testSsidInvalidTooLong()
hgs
parents: 31
diff changeset
   343
{
hgs
parents: 31
diff changeset
   344
    QString key("123456789012345678901234567890123");
hgs
parents: 31
diff changeset
   345
    WlanWizardUtils::SsidStatus status = WlanWizardUtils::validateSsid(key);
hgs
parents: 31
diff changeset
   346
    QCOMPARE(status, WlanWizardUtils::SsidStatusInvalidLength);
hgs
parents: 31
diff changeset
   347
}